最新消息:

python 使用 'python -m pip install --upgrade pip'更新失败的解决办法

Python 大步 3467浏览 0评论

 

室友拿他以前写的python web  demo放到我的pycharm里运行,结果提示没有mysqldb模块,然后pycharm里提示我pip的版本不对,让我升级到9.0.1 ,提示如下:

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

 

我先在pycharm的模块管理里升级pip,虽然pycharm提示安装成功,但是实际上是根本没有装上的。

 

按照要求,我使用下面的命令升级pip(以管理员身份运行):

python -m pip install --upgrade pip' command

 

 

运行结果:

C:\Python\Python27\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.2
Uninstalling pip-8.1.2:
Successfully uninstalled pip-8.1.2
Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
File "C:\Users\AlexY\AppData\Roaming\Python\Python27\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\AlexY\AppData\Roaming\Python\Python27\site-packages\pip\commands\install.py", line 317, in run
prefix=options.prefix_path,
File "C:\Users\AlexY\AppData\Roaming\Python\Python27\site-packages\pip\req\req_set.py", line 742, in install
**kwargs
File "C:\Users\AlexY\AppData\Roaming\Python\Python27\site-packages\pip\req\req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "C:\Users\AlexY\AppData\Roaming\Python\Python27\site-packages\pip\req\req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "C:\Users\AlexY\AppData\Roaming\Python\Python27\site-packages\pip\wheel.py", line 463, in move_wheel_files
generated.extend(maker.make(spec))
File "C:\Users\AlexY\AppData\Roaming\Python\Python27\site-packages\pip\_vendor\distlib\scripts.py", line 372, in make
self._make_script(entry, filenames, options=options)
File "C:\Users\AlexY\AppData\Roaming\Python\Python27\site-packages\pip\_vendor\distlib\scripts.py", line 276, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:\Users\AlexY\AppData\Roaming\Python\Python27\site-packages\pip\_vendor\distlib\scripts.py", line 212, in _write_script
launcher = self._get_launcher('t')
File "C:\Users\AlexY\AppData\Roaming\Python\Python27\site-packages\pip\_vendor\distlib\scripts.py", line 351, in _get_launcher
result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

 

坑爹了,这也失败。

 

 

然后google了下,找到了解决办法 :

1. 点击下载  get-pip.py   脚本。

2.然后运行这个脚本: python  get-pip.py

 

我们可以通过下面的命令查看pip版本:

python -m pip  -V

结果:

pip 9.0.1 from C:\Users\AlexY\AppData\Roaming\Python\Python27\site-packages (python 2.7)

 

 

但是问题是,我的pycharm里的pip仍然提示是8.0.1版本。然后,我先在pycharm里更新了python 3.7 的pip,成功更新 。不过,python 2.7 仍然失败,真是坑大爹。

 

最后灵光一闪,先升级到9.0.0,然后升级到9.0.1。结果还真成功了。

 

windows下python开发真坑爹。

 

 

参考:http://askubuntu.com/questions/644911/unable-to-upgrade-pip

 

 

 

 

 

转载请注明:大步's Blog » python 使用 'python -m pip install --upgrade pip'更新失败的解决办法

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
SiteMap