1、先在windows環境下,通過CMD將python安裝包清單導出到一個文件,命令如下:
pip freeze>list.txt
2、然後將list.txt上傳到CentOS7 根目錄下/
3、執行安裝命令
#pip install -r list.txt
如果安裝過程中出現以下錯誤,建議將pip下載源改成國內地址。
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org',
4、將pip下載源修改爲國內地址,這裏以清華大學鏡像地址爲例:
#cd
#mkdir .pip
#cd .pip
#vi pip.conf
添加如下內容並保存退出
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn