免费提问

python升级失败了怎么办?

144
提问者 魔力瓜瓜
2020-09-15 07:25 悬赏 0财富值 阅读 407回答 1

在一次升级pip的过程中,执行了下面的命令:

python -m pip install --upgrade pip

结果导致pip无法使用,也就是pip升级失败:

Traceback (most recent call last):
  File "setup.py", line 30, in <module>
    setup(
  File "G:\Program Files\Python38\lib\site-packages\setuptools\__init__.py", l
e 145, in setup
    return distutils.core.setup(**attrs)
  File "G:\Program Files\Python38\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "G:\Program Files\Python38\lib\distutils\dist.py", line 966, in run_com
nds
    self.run_command(cmd)
  File "G:\Program Files\Python38\lib\distutils\dist.py", line 985, in run_com
nd
    cmd_obj.run()
  File "G:\Program Files\Python38\lib\site-packages\setuptools\command\install
y", line 67, in run
    self.do_egg_install()
  File "G:\Program Files\Python38\lib\site-packages\setuptools\command\install
y", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File "G:\Program Files\Python38\lib\distutils\cmd.py", line 313, in run_comm
d
    self.distribution.run_command(command)
  File "G:\Program Files\Python38\lib\distutils\dist.py", line 985, in run_com
nd
    cmd_obj.run()
  File "G:\Program Files\Python38\lib\site-packages\setuptools\command\bdist_e
.py", line 233, in run
    make_zipfile(self.egg_output, archive_root, verbose=self.verbose,
  File "G:\Program Files\Python38\lib\site-packages\setuptools\command\bdist_e
.py", line 497, in make_zipfile
    visit(z, dirname, files)
  File "G:\Program Files\Python38\lib\site-packages\setuptools\command\bdist_e
.py", line 490, in visit
    z.write(path, p)
  File "G:\Program Files\Python38\lib\zipfile.py", line 1740, in write
    zinfo = ZipInfo.from_file(filename, arcname,
  File "G:\Program Files\Python38\lib\zipfile.py", line 538, in from_file


python
登录 后发表回答
太平长安灯
1楼 · 2020-09-15 08:55.采纳回答

你好,我也遇到过这样的问题,我在官方看过手册,操作方法如下:
python -m ensurepip
python -m pip install --upgrade pip

操作的过程是这样的:

G:\iso\pip-20.2.3\pip-20.2.3>python -m ensurepip
Looking in links: c:\Users\ADMINI~1\AppData\Local\Temp\tmpbzns4z6f
Requirement already satisfied: setuptools in g:\program files\python38\lib\site-
packages (41.2.0)
Collecting pip
Installing collected packages: pip
Successfully installed pip-19.2.3

G:\iso\pip-20.2.3\pip-20.2.3>python -m pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/4e/5f/528232275f6509b1fff
703c9280e58951a81abe24640905de621c9f81839/pip-20.2.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
Successfully installed pip-20.2.3

到这里,pip的修复升级工作就完成了。


网站简介 | 竞价技巧 | 网站建设 | 原创作品 | 联系我们 |

鄂ICP备17013851号-4|经营许可证:鄂B2-20160818 |互联网药品信息服务资格证: 粤20130124|鄂公网安备:42010601000001|版权登记号:2016SR017186