How Can I Install A Python Package Without Pip Or Virtualenv
Solution 1:
According to PEP370, starting with python 2.6 you can have a per-user site directory (see the What's new in Python 2.6?).
So you can use the --user
option of easy_install
to install the directory for each user instead of system-wide. I believe a similar option exists for pip
too.
This doesn't require any privileges since it only uses current user directories.
If you don't have any installer installed you can manually unpack the package into:
~/.local/lib/python2.6/site-packages
Or, if you are on Windows, into:
%APPDATA%/Python/Python26/site-packages
In the case of pycrypto
, the package requires building before installation because it contains some C code. The sources should contain a setup.py
file. You have to build the library running
python setup.py build
Afterwards you can install it in the user directory by giving:
python setup.py install --user
Note that the building phase might require some C library to already be installed.
If you don't want to do this, the only option is to ship the library together with your application.
By the way: I believe easy_install
doesn't really check whether you are root before performing a system wide install. It simply checks whether it can write in the system-wide site directory. So, if you do have the privileges to write there, there's no need to use sudo
in the first place. However this would be really odd...
Solution 2:
Use easy_install
. It should be installed already on Ubuntu for python 2.6+. If not take a look at these install instructions.
Post a Comment for "How Can I Install A Python Package Without Pip Or Virtualenv"