pip
Installation
Tutorials
NOTE: The following commands still require internet connection.
get-pip.py
# Latest version of python
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
# For python 2.7.x
curl https://bootstrap.pypa.io/2.7/get-pip.py -o get-pip.py
# Offline Install the pip
sudo pyhon get-pip.py
# Install pip
python3 -m pip install pip
Update the pip
pip install --upgrade pip
python3 -m pip install --upgrade pip
Module install
# Downloading the source files required for the module mkdocs, which requires an internet.
pip download -d <output-dir> mkdocs
# Offline install the module mkdocs
pip install <output-dir>/*.whl
Proxy server
pip install --proxy http://<usr_name>:<password>@<proxyserver_name>:<port#> <pkg_name>
pip config set global.proxy http://account:password@xxx.com.tw:8080
pip config set global.trusted-host pypi.python.org\npypi.org\nfiles.pythonhosted.org
Command
List installed modules
sudo pip list
Upgrade module
sudo pip install --upgrade <MODULENAME>
Export the list of installed modules
pip freeze > requirements.txt
Install modules in requirements.txt
pip install -r requirements.txt
Q & A
ERROR: Could not find a version that satisfies the requirement XXXX (from versions: none)
執行 pip install XXXX
時發生上述錯誤。
Solution:
改成這個指令:python -m pip install XXXX
No Comments