繁体   English   中英

尝试升级pip,但错误'WinError 5'出现了

[英]Tried to upgrade pip, but error 'WinError 5' showed up

我发现pip存在问题,不再对它做任何事情了。 我在Windows 7计算机上并使用荷兰语(可能会出现阅读问题)

我确实使用了pip版本8.1.1,但是有一个更新的版本,9.0.1。 我使用'pip install --upgrade pip'安装它并且他做得非常好,所以它卸载了以前版本的pip然后出现了问题。 现在我也不能使用pip。 当我尝试安装或升级我的系统时说:'ImportError:没有名为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'

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

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

你能跑吗?

python -m pip install -U pip

还是pip完全消失了?

如果它已经消失,那么你将不得不重新安装它。 也许重新安装所有的Python更容易,虽然可能更耗时。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM