pip指定更新源
pip install sweetest -i https://pypi.tuna.tsinghua.edu.cn/simple #pip使用更新源
安裝pip
python get-pip.py -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com # 使用安裝get-pip.py 安裝pip(python2不自帶pip)
get-pip.py鏈接:https://raw.githubusercontent.com/pypa/get-pip/master/get-pip.py (直接復制保存到本地就行)
如果安裝時出現編碼錯誤,需要在文件頭加上
# -*- coding: UTF-8 -*-
pip國內主要鏡像:
阿里雲 https://mirrors.aliyun.com/pypi/simple/ 中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/ 豆瓣(douban) http://pypi.douban.com/simple/ 清華大學 https://pypi.tuna.tsinghua.edu.cn/simple/ 中國科學技術大學 http://pypi.mirrors.ustc.edu.cn/simple
python版本華為鏡像下載:
https://mirrors.huaweicloud.com/python/
linux設置更新源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
windows設置更新源
找到python安裝目錄下的:\Lib\site-packages\pip\models\index.py文件,將PYPI的值改為你所需要的源即可,例如改為豆瓣的源。
#PyPI = Index('https://pypi.python.org/')
#PyPI = Index('https://mirrors.aliyun.com/pypi/simple') PyPI = Index('https://pypi.douban.com/')
