python - 在 Windows 上升级 Python 3.7 的 pip 但遇到权限错误
问题描述
我正在运行Win10 64位并尝试安装Python3.7并升级pip。
我将我的 Python 安装在 D:\python\python372-64 (并且在 python 文件夹中有其他版本的 python)。
Pip 应该与 Python 3 一起提供。当我运行时pip install pip --upgrade
,它说Found existing installation: pip 18.1
但是Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'd:\\python\\python372-64\\scripts\\pip.exe'. Consider using the '--user' option or check the permissions.'
所以我尝试以管理员身份运行,但它给了我以下错误:
Traceback (most recent call last):
File "d:\python\python372-64\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "d:\python\python372-64\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\Python\Python372-64\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'
但是,如果我运行,python -m ensurepip
我会得到:
Looking in links: C:\Users\jd\AppData\Local\Temp\tmpcww44m60
Requirement already satisfied: setuptools in d:\python\python372-64\lib\site-packages (40.6.2)
Collecting pip
Installing collected packages: pip
Successfully installed pip-18.1
另外,这是我的 PATH 环境变量:
D:\Python\Python372-64
D:\Python\Python372-64\Lib\site-packages\
D:\Python\Python372-64\Scripts
我应该怎么做才能解决这个问题?
解决方案
这解决了它!
py -3.72 -m pip install --upgrade pip
推荐阅读
- css - 水平滚动 div 中动画的卡片间距问题
- go - 将struct转换为YAML文件golang,如何避免yaml输出中的空引号?
- c - 管道(),叉子();执行();我为 `cat | 寻找与 bash 相同的行为。ls`
- python - 使用 Python 和 Snowflake 进行列匹配
- r - 使用 R 为子集数据创建循环
- audio - 如何反转滑块的这个 ln 幂函数?
- node.js - 从 Nodejs8.x 升级到 Nodejs10.x 或 Nodejs12.x 出现错误 - 找不到模块“is-buffer”
- mysql - 许多查询并行运行。提交一个查询会影响其他所有查询吗?
- xaml - 如何阻止 Xamarin 初始化 XAML 中的每个视图?
- kubernetes - 模板 Chart.yaml 文件