python pip full command list

  1. list or check packages
$ pip list
$ pip search pkg
$ pip list --outdated
$ pip show pkg

2. download package

$ pip download --destination-directory /local/wheels -r requirements.txt
$ pip install --no-index --find-links=/local/wheels -r requirements.txt

create wheel file from downloaded package:
$ pip install wheel
$ pip wheel --wheel-dir=/local/wheels -r requirements.txt

3. install packages

install from local:
$ pip install --no-index --find-links=/local/wheels pkg

install with version:
$ pip install pkg>=2.1.2
$ pip install pkg==2.1.2

export installed pkgs and install it:
pip freeze >requirements.txt
pip install -r requirements.txt

4. install with proxy server

$ pip install --proxy [user:passwd@]http_server_ip:port pkg
or you can configure it in $HOME/.config/pip/pip.conf

# Linux/Unix:
/etc/pip.conf
~/.pip/pip.conf
~/.config/pip/pip.conf

# Mac OSX:
~/Library/Application Support/pip/pip.conf
~/.pip/pip.conf
/Library/Application Support/pip/pip.conf

# Windows:
%APPDATA%\pip\pip.ini
%HOME%\pip\pip.ini
C:\Documents and Settings\All Users\Application Data\PyPA\pip\pip.conf (Windows XP)
C:\ProgramData\PyPA\pip\pip.conf

Here is a sample pip.conf:
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/ 

# change to your proxy[user:passwd@]proxy.server:port
proxy=http://xxx.xxx.xxx.xxx:8080 

[install]
trusted-host=mirrors.aliyun.com

5. upgrade and uninstall

$ pip install --upgrade pkg
$ pip install --upgrade pkg1 --upgrade-strategy only-if-need
$ pip uninstall pkg

Leave a Reply

Your email address will not be published. Required fields are marked *