如何将Python安装第三方库的源切换到国内镜像?

2026-05-24 15:471阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计324个文字,预计阅读时间需要2分钟。

如何将Python安装第三方库的源切换到国内镜像?

将原文简化并修改如下:

修改pip配置,设置全局索引源为阿里云镜像:pip config set global.index-url https://mirrors.aliyun.com/pypi/simple

永久修改

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

其他

这个都属于pip 命令行,config 后面参数

C:\Users\Administrator>pip config
ERROR: Need an action (debug, edit, get, list, set, unset) to perform.

命令

说明

pip config edit

编辑配置文件(windows在终端不能编辑)

pip config get

获取配置项的值,例如pip config get global.index-url

如何将Python安装第三方库的源切换到国内镜像?

pip config list

列出所有配置

pip config set

添加配置

pip config unset

删除配置

另外windows上还有一个​​pip config debug​​ 可以查看各个作用域的pip.ini文件,以及其内容。

其他2

之前一直自己写入添加​​pip.ini​​文件,近期才知道pip已经做了这些功能,才发现自己做了重复劳动。后悔不已,竟然学了这么久python才知道,很是惭愧。


本文来自博客园,作者:​​Hello_wshuo​​​,转载请注明原文链接:​​javascript:void(0)p/15622139.html​​


本文共计324个文字,预计阅读时间需要2分钟。

如何将Python安装第三方库的源切换到国内镜像?

将原文简化并修改如下:

修改pip配置,设置全局索引源为阿里云镜像:pip config set global.index-url https://mirrors.aliyun.com/pypi/simple

永久修改

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

其他

这个都属于pip 命令行,config 后面参数

C:\Users\Administrator>pip config
ERROR: Need an action (debug, edit, get, list, set, unset) to perform.

命令

说明

pip config edit

编辑配置文件(windows在终端不能编辑)

pip config get

获取配置项的值,例如pip config get global.index-url

如何将Python安装第三方库的源切换到国内镜像?

pip config list

列出所有配置

pip config set

添加配置

pip config unset

删除配置

另外windows上还有一个​​pip config debug​​ 可以查看各个作用域的pip.ini文件,以及其内容。

其他2

之前一直自己写入添加​​pip.ini​​文件,近期才知道pip已经做了这些功能,才发现自己做了重复劳动。后悔不已,竟然学了这么久python才知道,很是惭愧。


本文来自博客园,作者:​​Hello_wshuo​​​,转载请注明原文链接:​​javascript:void(0)p/15622139.html​​