pip-9.0.1更新到pip-10.0.0遇到的问题

环境为Ubuntu16.4 LTS 64bit,在使用pip的过程中,总是提醒我当前使用的9.0.1版本,有更新的版本10.0.0可以使用

提示如下:

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

可是,当我敲入上面的

pip install --upgrade pip
命令之后,
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
  Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
  File "/home/gritzhang/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/gritzhang/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/home/gritzhang/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/home/gritzhang/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/home/gritzhang/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/home/gritzhang/.local/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/home/gritzhang/.local/lib/python2.7/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/home/gritzhang/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip-10.0.1.dist-info'
You are using pip version 9.0.1, however version 10.0.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

异常的话,应该可以通过提示解决掉这个问题,可以看到是因为执行命令 mkdir(name,mode);

所以在执行下面的

pip install --upgrade pip

这句命令时,在前面加上sudo  pip install --upgrade pip 然后输入密码执行就“显示”成功安装了。

但是安装后试一下pip list 提示如下:

bash: /home/gritzhang/.local/bin/pip: No such file or directory

这个就是环境变量里的执行地址不一样了,改一下环境变量,查看了一下pip10的目录发现里面除了几个txt什么都没有,而且此时的pip不管用了,好吧,重新去官网下载了一压缩包(点击即可下载),然后解压,放到python的安装文件夹下,进入pip目录中执行python setup.py,之后就OK了,用上了新的pip版本,本可以不这么费事,好吧,虽然曲折了一点儿,但是结果很OK!!!

你可能感兴趣的:(python之路)