常用pip源
阿里雲 [http://mirrors.aliyun.com/pypi/simple/][1] 中國科技大學 [https://pypi.mirrors.ustc.edu.cn/simple/][2] 豆瓣(douban) [http://pypi.douban.com/simple/][3] 清華大學 [https://pypi.tuna.tsinghua.edu.cn/simple/][4] 中國科學技術大學 [http://pypi.mirrors.ustc.edu.cn/simple/][5] 華中理工大學:[http://pypi.hustunique.com/][6] 山東理工大學:[http://pypi.sdutlinux.org/][7]
pip源配置
1. 永久方法(不用每次打上URL)
1)windows文件管理器下輸入:%APPDATA%
2)新建pip文件夾,在pip文件夾下新建pip.ini文件
3)輸入如下代碼並保存
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple/ [install] trusted-host=pypi.tuna.tsinghua.edu.cn
2. pip升級
python -m pip install --upgrade pip
3. 檢查哪些包需要更新
pip list --outdated
4.
常用pip下載命令
0. 已配置pip源,單獨安裝
pip install xlrd # 不指定版本
pip install xlrd==1.2.0 # 指定版本
1.通過pip源安裝: pip install jupyter -i http://pypi.tuna.tsinghua.edu.cn/simple
使用上述命令出錯:

重新執行:pip install jupyter -i http://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
2. 批量安裝
1)准備requirements.txt文件
格式如圖:

2)執行命令: pip install -r requirements.txt
3.升級指定開源庫xlrd: pip install --upgrade xlrd
4.下載源碼包安裝:
1)進入開源庫的setup.py所在文件夾,
2)執行: python setup.py install
5. pip卸載包: pip uninstall 要卸載的包名
6. 生成requirements.txt文件: pip freeze > requirements.txt
7.列出已安裝了那些包:
pip freeze
pip list
8. linux和windows下某些命令存在差異,查看幫助可通過
pip --help
常見錯誤
########################################################################################################################################################################
問題1:pillow下載失敗
解決方式:
1.查看pip源是否正常
2.到開源安裝包目錄下找到pillow相關的如pillow*,PIL文件夾,刪除,重新pip安裝
C:\python\python27\Lib\site-packages
########################################################################################################################################################################
問題2:pip安裝開源庫,出現SSL關鍵字相關錯誤,如下

解決方式:
未給定受信任的源,需要在用戶目錄下新建pip/pip.ini文件,並添加如下信息
[global]
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
disable-pip-version-check = true
timeout = 120
[list]
format = columns
重新下載即可成功。
########################################################################################################################################################################
問題3:python2.7環境下,安裝image==1.5.28出現如下問題
ERROR: Could not install packages due to an EnvironmentError: [Errno 22] invalid mode ('wb') or filename:

解決方式:
1.安裝 Django>=1.8.17
2.安裝image==1.5.28
Django2.0不支持python2.7
########################################################################################################################################################################
問題4:
解決方式:
########################################################################################################################################################################
問題5:
解決方式:
########################################################################################################################################################################
