Python配置

Python安装配置,以及pip镜像源更换

Python下载安装

Python官网下载地址:https://www.python.org/downloads/windows/ 参考:下载教程

下载之后双击运行程序 1 2 3

pip 配置国内镜像源

临时下载使用

阿里镜像源:

1
pip install 包名 -i https://mirrors.aliyun.com/pypi/simple/ --user

清华镜像源:

1
pip install 包名 -i https://pypi.tuna.tsinghua.edu.cn/simple/ --user

永久配置

命令配置

阿里镜像源:

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

清华镜像源:

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

手动配置

打开 C:\<用户名>\AppData\Roaming\pip 文件夹,在里面新建一个 pip.ini 文件,输入以下内容:(找 不到AppData文件夹,请点击查看教程以winll为例) 阿里镜像源:

1
2
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

清华镜像源:

1
2
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/

检查是否配置成功

1
pip config get global.index-url

当看到输出为:https://mirrors.aliyun.com/pypi/simple/https://pypi.tuna.tsinghua.edu.cn/simple/ 则配置成功