@[PYTHON](安装国内镜像源)
打开cmd窗口输入:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
如果出现以下错误:
ERROR: Unable to save configuration. Please report this as a bug.
Traceback (most recent call last):
File “C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\site-packages\pip_internal\commands\configuration.py”, line 267, in _save_configuration
self.configuration.save()
File “C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\site-packages\pip_internal\configuration.py”, line 213, in save
with open(fname, “w”) as f:
PermissionError: [Errno 13] Permission denied: ‘C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\pip.ini’
ERROR: Internal Error.
请确保以管理员身份运行,如果还是不行可能是一个pip bug,就输入以下命令:
python3 -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple --user
详见[Can’t set pip source on
Windows#10800]:https://github.com/pypa/pip/issues/10800