【python】python3.x 在Windows 10 下的环境配置——pip永久换源成国内镜像

pip更换源,换成国内镜像

由于使用pip或pip3安装python第三方包时,经常出现read timed out问题,所以需要将pip的官方软件源服务器换成国内的镜像服务器,从而提升python软件包安装效率和成功率。

1、pip国内镜像地址

阿里云 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/

2、pip换源方法

2.1 pip永久换源

pip永久换源:(个人推荐阿里云的源)

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/


在cmd命令行中输入上述命令即可。下图为例
在这里插入图片描述
最后,升级 pip 到最新的版本
python3.8.5请用方式一升级:

python -m pip install --user --upgrade pip

python其余版本可以用方式二:

pip install pip -U

如果方式二方法升级失败,出现错误:Script file ‘D:\software_install\Anaconda_install\Scripts\pip-script.py’ is not present.参考这个博客解决错误:Script file ‘D:\software_install\Anaconda_install\Scripts\pip-script.py‘ is not present.完美解决方法,然后再尝试用方式一解决。
方式一的参考博客是错误Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: ‘c:\programdata\anaconda3\lib\site-packages\pip-18.1.dist-info\entry_points.txt’ Consider using the --user option or check the permissions.的解决方法
在这里插入图片描述

2.2 临时指定pip源

 # 以使用清华大学的镜像源安装matplotlib为例
 pip install matplotlib -i  https://pypi.tuna.tsinghua.edu.cn/simple/

参考博客
浅析Python3 pip换源问题

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值