Python pip: Difference between revisions
From wikinotes
No edit summary |
(→Usage) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
|- | |- | ||
| <code>~/.local/lib/pythonX.X/site-packages</code> || user packages | | <code>~/.local/lib/pythonX.X/site-packages</code> || user packages | ||
|- | |||
| <code>/etc/pip.conf</code><br><code>~/.config/pip/pip.conf</code> || pip configuration | |||
|- | |- | ||
|} | |} | ||
Line 21: | Line 23: | ||
<blockquote> | <blockquote> | ||
<source lang="bash"> | <source lang="bash"> | ||
pip install <package> | pip install <package> # install package | ||
pip install --user <package> | pip install --user <package> # install to $HOME dir | ||
pip install --user \ `# install to $HOME dir, bypassing externally managed envs` | |||
--break-system-packages \ | |||
<package> | |||
pip install "${package}==1.1.1" # install specific version of package | |||
pip install 'git+https://github.com/tangentlabs/django-oscar-paypal.git@master | pip install 'git+https://github.com/tangentlabs/django-oscar-paypal.git@master | ||
Line 34: | Line 40: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- usage --> | </blockquote><!-- usage --> | ||
= Configuration = | |||
<blockquote> | |||
<syntaxhighlight lang="dosini"> | |||
[global] | |||
# if you MUST install system packages with pip, this is your escape-hatch | |||
break-system-packages = true | |||
</syntaxhighlight> | |||
</blockquote><!-- Configuration --> |
Latest revision as of 02:34, 7 July 2023
python package manager.
Locations
~/.local/lib/pythonX.X/site-packages
user packages /etc/pip.conf
~/.config/pip/pip.conf
pip configuration
Install
python2 <(curl https://bootstrap.pypa.io/pip/2.7/get-pip.py) python3 <(curl https://bootstrap.pypa.io/pip/get-pip.py)
Usage
pip install <package> # install package pip install --user <package> # install to $HOME dir pip install --user \ `# install to $HOME dir, bypassing externally managed envs` --break-system-packages \ <package> pip install "${package}==1.1.1" # install specific version of package pip install 'git+https://github.com/tangentlabs/django-oscar-paypal.git@master pip list # list installed pip search <package> # deprecatedimport site site.getusersitedir() # pip install --user packages installed here
Configuration
[global] # if you MUST install system packages with pip, this is your escape-hatch break-system-packages = true