尝试升级pip,但出现错误“WinError 5”

2024-04-23 13:41:51 发布

您现在位置:Python中文网/ 问答频道 /正文

我发现皮普有问题,不能再做任何事了。 我在一台Windows7电脑上,会说荷兰语(可能会出现阅读问题)

我确实使用了pip版本8.1.1,但是有一个更新的版本,9.0.1。我用'pip install--upgrade pip'安装它,他做得很好,所以它卸载了以前版本的pip,然后问题来了。现在我也不能用pip了。当我尝试安装或升级我的系统时,会说:“ImportError:No module named pip”。在

我在2016年的某个地方遇到了这个问题,一直没有找到答案,所以我又在电脑上安装了Python。我希望有更好的方法来完成这项工作,而不是再次安装整个Python和所有这些模块。在

所以对我来说这有点奇怪,我希望每个人都知道这个问题并知道解决这个问题的方法。下面我将在命令提示符中显示文本。在

代码:

You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.

D:\PythonProjects\Python Crash Course\learning_log\ll_env\Scripts>pip install --
upgrade pip
Collecting pip
  Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 8.1.1
    Uninstalling pip-8.1.1:
Exception:
Traceback (most recent call last):
  File "C:\Users\Pascal\AppData\Local\Programs\Python\Python35\lib\shutil.py", l
ine 538, in move
    os.rename(src, real_dst)
OSError: [WinError 17] Het systeem kan het bestand niet verplaatsen naar een and
er station: 'd:\\pythonprojects\\python crash course\\learning_log\\ll_env\\scri
pts\\pip.exe' -> 'C:\\Users\\Pascal\\AppData\\Local\\Temp\\pip-0hagtsau-uninstal
l\\pythonprojects\\python crash course\\learning_log\\ll_env\\scripts\\pip.exe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\pythonprojects\python crash course\learning_log\ll_env\lib\site-packa
ges\pip\basecommand.py", line 209, in main
  File "d:\pythonprojects\python crash course\learning_log\ll_env\lib\site-packa
ges\pip\commands\install.py", line 317, in run
  File "d:\pythonprojects\python crash course\learning_log\ll_env\lib\site-packa
ges\pip\req\req_set.py", line 726, in install
  File "d:\pythonprojects\python crash course\learning_log\ll_env\lib\site-packa
ges\pip\req\req_install.py", line 746, in uninstall
  File "d:\pythonprojects\python crash course\learning_log\ll_env\lib\site-packa
ges\pip\req\req_uninstall.py", line 115, in remove
  File "d:\pythonprojects\python crash course\learning_log\ll_env\lib\site-packa
ges\pip\utils\__init__.py", line 267, in renames
  File "C:\Users\Pascal\AppData\Local\Programs\Python\Python35\lib\shutil.py", l
ine 553, in move
    os.unlink(src)
PermissionError: [WinError 5] Toegang geweigerd: 'd:\\pythonprojects\\python cra
sh course\\learning_log\\ll_env\\scripts\\pip.exe'

D:\PythonProjects\Python Crash Course\learning_log\ll_env\Scripts>pip freeze > r
equirements.txt
Traceback (most recent call last):
  File "C:\Users\Pascal\AppData\Local\Programs\Python\Python35\lib\runpy.py", li
ne 184, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\Pascal\AppData\Local\Programs\Python\Python35\lib\runpy.py", li
ne 85, in _run_code
    exec(code, run_globals)
  File "D:\PythonProjects\Python Crash Course\learning_log\ll_env\Scripts\pip.ex
e\__main__.py", line 5, in <module>
ImportError: No module named 'pip'

Tags: installpipinpyenvloglibline
1条回答
网友
1楼 · 发布于 2024-04-23 13:41:51

这与Windows上的磁盘驱动器有关。Pip将新文件下载到当前驱动器(D:),然后尝试将它们移到系统文件(位于C:)上,但失败了。在

(见https://github.com/pypa/pip/issues/2824

你能跑吗

python -m pip install -U pip

或者pip完全消失了?在

如果它不见了,你就得重新安装。也许重新安装所有Python会更容易,尽管可能更耗时。在

相关问题 更多 >