Installing pip packages to $HOME folder
While you can use a virtualenv
, you don't need to. The trick is passing the PEP370 --user
argument to the setup.py
script. With the latest version of pip
, one way to do it is:
pip install --user mercurial
This should result in the hg
script being installed in $HOME/.local/bin/hg
and the rest of the hg package in $HOME/.local/lib/pythonx.y/site-packages/
.
Note, that the above is true for Python 2.6. There has been a bit of controversy among the Python core developers about what is the appropriate directory location on Mac OS X for PEP370-style user
installations. In Python 2.7 and 3.2, the location on Mac OS X was changed from $HOME/.local
to $HOME/Library/Python
. This might change in a future release. But, for now, on 2.7 (and 3.2, if hg
were supported on Python 3), the above locations will be $HOME/Library/Python/x.y/bin/hg
and $HOME/Library/Python/x.y/lib/python/site-packages
.
Install a Python package into a different directory using pip?
Use:
pip install --install-option="--prefix=$PREFIX_PATH" package_name
You might also want to use --ignore-installed
to force all dependencies to be reinstalled using this new prefix. You can use --install-option
to multiple times to add any of the options you can use with python setup.py install
(--prefix
is probably what you want, but there are a bunch more options you could use).
Installing Python packages from local file system folder to virtualenv with pip
I am pretty sure that what you are looking for is called --find-links
option.
You can do
pip install mypackage --no-index --find-links file:///srv/pkg/mypackage
Pip packages installed inside the env and globally
First, activate the virtualenv by source {your_virtual_enviroment_name}/bin/activate
Second, install the libraries by pip install {library_name}
or pip install -r requirements.txt
if you have one.
How to configure folder with pip files as local pip repository
you need to use the --find-links
flag (add --no-index
to not use pypi.org at all):
pip install --no-index --find-links=MyPip pandas
https://pip.pypa.io/en/stable/user_guide/#installing-from-local-packages
Installing pip packages to $HOME folder
While you can use a virtualenv
, you don't need to. The trick is passing the PEP370 --user
argument to the setup.py
script. With the latest version of pip
, one way to do it is:
pip install --user mercurial
This should result in the hg
script being installed in $HOME/.local/bin/hg
and the rest of the hg package in $HOME/.local/lib/pythonx.y/site-packages/
.
Note, that the above is true for Python 2.6. There has been a bit of controversy among the Python core developers about what is the appropriate directory location on Mac OS X for PEP370-style user
installations. In Python 2.7 and 3.2, the location on Mac OS X was changed from $HOME/.local
to $HOME/Library/Python
. This might change in a future release. But, for now, on 2.7 (and 3.2, if hg
were supported on Python 3), the above locations will be $HOME/Library/Python/x.y/bin/hg
and $HOME/Library/Python/x.y/lib/python/site-packages
.
Related Topics
How to Check the Versions of Python Modules
Writing a Dictionary to a CSV File with One Line for Every 'Key: Value'
How to Account for Period (Am/Pm) Using Strftime
How Did Python Implement the Built-In Function Pow()
Valueerror: Could Not Convert String to Float: Id
Execute Terminal Command from Python in New Terminal Window
Matplotlib Fill Between Multiple Lines
In Pytest, What Is the Use of Conftest.Py Files
How to Format a String Using a Dictionary in Python-3.X
Absolute VS. Explicit Relative Import of Python Module
Pandas Split Column into Multiple Columns by Comma
How to Compare String and Integer in Python