The default location where pip installes packages on my Ubuntu system is '/usr/local/lib/pytho2.7/dist-packages/' which I think is the default in general. I am using Enthought python distribution (EPD not canopy) and would like to install a package into EPD as I usually work with the python from the EPD distribution on my system. I would like to know into which directory inside EPD the new files need to be installed using pip ; as the directory structure for EPD on linux seems to be quite different from the EPD directory structure on MAC OS for where there seem to be many examples.
Also I have come across this :
pip install --install-option="--prefix=$PREFIX_PATH" package_name
as the accepted answer to a question similar to this. I would like to know what the purpose of the $PREFIX_PATH environment variable is as mine is currently blank. And what path I need to specify on Ubuntu for my Enthought EPD distribution to install python modules.
I apologize for the relatively naive question but I am quite new to EPD on ubuntu and am still trying to figure it out.
To change install location, click on Customize installation , then Next and enter C:\python35 (or another appropriate location) as the install location. If you didn�t check the Add Python 3.5 PATH option earlier, check Add Python to environment variables .
For the environments use https://conda.io/docs/user-guide/tasks/manage-environments.html to activate the desired environment, then you can pip install or conda install the packages and it will be places safely only in that environment.
Click on the Advanced system settings link on the left panel. Click Environment Variables. Under System Variables, double-click the variable PATH. Click New, and add the directory where pip is installed, e.g. C:Python\Scripts, and select OK.
By default, on Linux, Pip installs packages to /usr/local/lib/python2. 7/dist-packages. Using virtualenv or --user during install will change this default location. If you use pip show make sure you are using the right user or else pip may not see the packages you are referencing.
This line should work for everyone, as mentioned in the documentation.
pip install package_name -t any/path/i/like
PS:
And to address the comment of @CPiLL, the any/path/i/like
can really be anything, such as /tmp/my-test-env
. The package being installed in this way will NOT be available for your usual python environment, in fact they will NOT even show up using pip list
. And python -c "import package_name"
will generally FAIL with ImportError exception, unless you cd into that folder first:
cd /tmp/my-test-env python -c "import package-name"
How this technique would be useful is beyond this answer.
System: Ubuntu 12.04, Enthought Python Distribution (this is where I wanted to install a new python module)
So the prefix_path environment variable didn't work for me and pip still kept installing it in the default location. But I used How do I change the default directory that pip installs to?
question as a guide. And one of the answers helped me achieve what I needed.
pip install -d <path_to_my_directory>
For the path I used: path_to_epd_directory/lib/python2.7/site-packages
This puts the tar.gz file into the site-packages
Then extract it using:
tar -zxvf pymodule.tar.gz
a directory named pymodule is created, cd into that module and type:
python setup.py install
and that should do the job.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With