修改pip配置文件pip.ini显示权限不足,无法写入时该如何解决
如题,尝试修改pip配置
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
时出现如下报错:
Writing to C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\pip.ini
ERROR: Unable to save configuration. Please report this as a bug.
Traceback (most recent call last):
File "C:\Users\wosai\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pip\_internal\configuration.py", line 215, in save
with open(fname, "w") as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\\pip.ini'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\wosai\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pip\_internal\commands\configuration.py", line 267, in _save_configuration
self.configuration.save()
File "C:\Users\wosai\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pip\_internal\configuration.py", line 219, in save
f"An error occurred while writing to the configuration file "
pip._internal.exceptions.ConfigurationError: An error occurred while writing to the configuration file C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\pip.ini: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\\pip.ini'
ERROR: Internal Error.
一句话解答:在命令后加上--user
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple --user