pip升级 pip国内源 conda源 - python开发常用

# 全局设置清华源

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

#升级pip

pip install pip -U
python -m pip install --upgrade pip
-i https://pypi.tuna.tsinghua.edu.cn/simple 
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ # 阿里源

conda

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes



# win10   powershell   如果无法 active 需要执行

关于执行策略 - PowerShell | Microsoft Docs

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned


PIP国内源:

新版ubuntu要求使用https源,要注意。

清华:Simple Index

阿里云:Simple Index

中国科技大学 Simple Index

华中理工大学:http://pypi.hustunique.com/

山东理工大学:Loading...

豆瓣:Simple Index

阿里云 http://mirrors.aliyun.com/pypi/simple/ 
  豆瓣(douban) http://pypi.douban.com/simple/ 
  清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 
  中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

临时使用:

可以在使用pip的时候加参数-i Simple Index

例如:pip install -i Simple Index pyspider,这样就会从清华这边的镜像去安装pyspider库。




永久修改,一劳永逸:

Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)

内容如下:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
  • # 然后执行
  • pip install update

windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini。内容同上。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值