pip離線安裝包

打包已安裝的依賴包

生成已安裝包清單python

pip freeze >requirements.txt

如本地保留了以前下載的各依賴包,直接將各whl/tar/zip包保存到某個文件夾下,如./packageslinux

如本地未保留以前下載的各依賴包whl/tar/zip包,則須要用下面的命令從網絡下載到./packages網絡

pip download -r requirements.txt  -d ./packages

指定參數下載架構

pip download \
    --only-binary=:all: \ # 只下載二進制package(即wheel或egg)
    --platform linux_x86_64 \ # 說明是linux 64位架構
    --python-version 27 \ # Python 2.7
    --implementation cp \ # cpython,通常都是這個
    --abi cp27mu
    -r requirements.txt  -d ./packages

離線批量安裝依賴包

packages 文件夾和 requirements.txt拷貝至離線機器上某個目錄下,ui

packages文件夾 和 requirements.txt放在同目錄下,命令窗口進入D:,輸入如下命令,依賴包便可批量安裝完成url

離線安裝依賴包code

pip install --no-index --find-links=./packages -r requirements.txt

參數

pip download -h 查看幫助信息orm

Usage:   
  pip download [options] <requirement specifier> [package-index-options] ...
  pip download [options] -r <requirements file> [package-index-options] ...
  pip download [options] [-e] <vcs project url> ...
  pip download [options] [-e] <local project path> ...
  pip download [options] <archive url/path> ...

參考:
Python pip離線安裝package方法總結ip

相關文章
相關標籤/搜索