python的包管理
本文来自:
https://www.cnblogs.com/aifengqi/articles/15402157.html
国内的一些镜像
阿里云 http://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/
PIP 更换国内安装源
临时使用
可以在使用pip的时候在后面加上-i参数,指定pip源
pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple
永久修改
linux
修改 ~/.pip/pip.conf (没有就创建一个), 内容如下:
# cat ~/.pip/pip.conf [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple
windows
直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,在pip 目录下新建文件pip.ini,内容如下
或者按照网友的建议:win+R 打开用户目录%HOMEPATH%,在此目录下创建 pip 文件夹,在 pip 目录下创建 pip.ini 文件, 内容如下
[global] timeout = 6000 index-url = https://pypi.tuna.tsinghua.edu.cn/simple trusted-host = pypi.tuna.tsinghua.edu.cn
easy_install更换国内安装源
创建配置文件:
Windows下是在: ~\pydistutils.cfg
Linux下是在: $HOME/.pydistutils.cfg
[easy_install] index-url=http://pypi.douban.com/simple
poetry 更换国内安装源
poetry 使用的是配置文件安装内容,因此在配置文件中加入下面的内容
[[tool.poetry.source]] name = "tsinghua" url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/" default = true # 添加一个 default 参数, 使 poetry 的默认回调行为都调用到这个清华镜像上.
MACOS 上的修改方式与linux基本一致

浙公网安备 33010602011771号