嗨,我正在使用spyder,我想升级点子(我的实际点子版本是9.0.3)。
我尝试通过cmd
键入以下内容来实现此目的:
python -m pip install --upgrade pip
但是我收到一条错误消息:
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, "Connessione in corso interrotta forzatamente dall'host remoto", None, 10054, None))': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, "Connessione in corso interrotta forzatamente dall'host remoto", None, 10054, None))': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, "Connessione in corso interrotta forzatamente dall'host remoto", None, 10054, None))': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, "Connessione in corso interrotta forzatamente dall'host remoto", None, 10054, None))': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, "Connessione in corso interrotta forzatamente dall'host remoto", None, 10054, None))': /simple/pip/
Requirement already up-to-date: pip in c:\program files\python36\lib\site-packages
You are using pip version 9.0.3, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
我还尝试使用此代码(设置其他代理-因为我的公司的笔记本电脑有防火墙)来升级pip:
python -m pip install --upgrade pip --proxy="http://user:password@proxyname.com:portnumber"
但我再次遇到错误:
Exception:
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\shutil.py", line 544, in move
os.rename(src, real_dst)
PermissionError: [WinError 5] Accesso negato: 'c:\\program files\\python36\\lib\\site-packages\\pip-9.0.3.dist-info\\description.rst' -> 'C:\\Users\\indelicl\\AppData\\Local\\Temp\\pip-7kqirkkb-uninstall\\program files\\python36\\lib\\site-packages\\pip-9.0.3.dist-info\\description.rst'
在处理上述异常期间,发生了另一个异常:
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Program Files\Python36\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "C:\Program Files\Python36\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
renames(path, new_path)
File "C:\Program Files\Python36\lib\site-packages\pip\utils\__init__.py", line 267, in renames
shutil.move(old, new)
File "C:\Program Files\Python36\lib\shutil.py", line 559, in move
os.unlink(src)
PermissionError: [WinError 5] Accesso negato: 'c:\\program files\\python36\\lib\\site-packages\\pip-9.0.3.dist-info\\description.rst'
You are using pip version 9.0.3, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
我该怎么做?
答案 0 :(得分:1)
异常消息包含您要查找的信息。
PermissionError: [WinError 5] Accesso negato: 'c:\\program files\\python36\\lib\\site-packages\\pip-9.0.3.dist-info\\description.rst' -> 'C:\\Users\\indelicl\\AppData\\Local\\Temp\\pip-7kqirkkb-uninstall\\program files\\python36\\lib\\site-packages\\pip-9.0.3.dist-info\\description.rst'
这表明您没有足够的权限来编辑pip
文件。特别是PermissionError
异常类型和Accesso negato
(Permission denied
)错误消息。
为解决此问题,您需要使用sudo
运行命令(在Linux系统上)或以管理员身份运行命令(在Windows上)。
您似乎在Windows上,因此应该能够右键单击“命令提示符”图标,然后单击“以管理员身份运行”,然后从提升的外壳中运行命令。值得一提的是,默认情况下您不应该这样做,只有在知道有必要的情况下才应使用提升的权限运行(在这种情况下就是如此)。