Python3 pip3查看和设置当前镜像源

1.修改前建议更新pip版本到最新

CN1414000142M:~ $ pip3 install --upgrade pip   
Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/eb/4a3642e971f404d69d4f6fa3885559d67562801b99d7592487f1ecc4e017/pip-20.3.3-py2.py3-none-any.whl (1.5MB)
     |████████████████████████████████| 1.5MB 20kB/s 
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
Successfully installed pip-20.3.3

2.命令行修改源:

chennybaba:~ $ pip3 config set global.index-url https://pypi.douban.com/simple/
Writing to /Users/chenhang_vendor/.config/pip/pip.conf

3.查看当前源:

chennybaba:~ $ pip3 config list
global.index-url='https://pypi.douban.com/simple/'

常用源:
阿里云

http://mirrors.aliyun.com/pypi/simple/

清华大学

https://pypi.tuna.tsinghua.edu.cn/simple/

中国科技大学

https://pypi.mirrors.ustc.edu.cn/simple/

中国科学技术大学

http://pypi.mirrors.ustc.edu.cn/simple/

豆瓣

https://pypi.douban.com/simple/
  • 38
    点赞
  • 83
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
要切换Pythonpip镜像源,可以按照以下步骤进行操作: 1. 在命令行中运行`pip config`命令,检查当前pip的配置信息。 2. 如果已经存在`pip.conf`或`pip.ini`文件,可以直接编辑该文件。如果没有找到该文件,可以手动创建一个新的`pip.conf`或`pip.ini`文件。 3. 在配置文件中添加以下内容来设置pip镜像源为清华大学的镜像源: ``` [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple ``` 4. 保存配置文件并退出编辑器。 5. 现在,你的pip镜像源已经切换为清华大学的镜像源。你可以使用`pip install`命令来安装Python包,并且下载速度应该会更快。 请注意,如果你使用的是虚拟环境(例如使用`pipenv`),你可以通过在命令行中运行`pipenv install --pypi-mirror https://pypi.tuna.tsinghua.edu.cn/simple`来设置镜像源为清华大学的镜像源。这将为你的虚拟环境安装Python包并使用清华大学的镜像源进行下载。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [更改pip的两种方法](https://blog.csdn.net/weixin_59246157/article/details/129578658)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值