1. 程式人生 > >pip離線安裝方法

pip離線安裝方法

pip離線安裝

python線上打包和離線安裝

  1. 將軟體包名稱和版本寫入requirements.txt
    #格式:

cat requirements.txt
PyMySQL==0.7.11
wheel==0.29.0
mysql-replication==0.13

  1. 下載requirements.txt中的軟體包

pip download -d tmp -r requirements.txt

3.在沒有網路的環境安裝python軟體包
#有多個檔案的情況下,需要指定多個檔案

pip install --no-index --find-links=./tmp/PyMySQL-0.7.11-py2.py3-none-any.whl
–find-links=./tmp/wheel-0.29.0-py2.py3-none-any.whl
–find-links=./tmp/mysql-replication-0.13.tar.gz -r requirements.txt