pip和sudo pip的不同点数版本

时间:2017-04-09 10:12:30

标签: python python-2.7 pip osx-yosemite

我正在使用OSX Yosemite和python版本2.7.12 | Anaconda 4.2.0(x86_64)

每次我使用pip时,都会显示You are using pip version 8.1.2, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.

键入pip -V,获取pip 8.1.2 from /Library/Python/2.7/site-packages (python 2.7)

当我尝试使用pip install --upgrade pip升级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:

Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 736, in install
     requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/Users/YTQ/anaconda/lib/python2.7/shutil.py", line 303, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-8.1.2.dist-info/DESCRIPTION.rst'

我认为这可能是用户权限问题,所以我使用了sudo pip install --upgrade pip

但是,现在只有当我拨打sudo pip -V时,它才会返回pip 9.0.1 from /Users/YTQ/anaconda/lib/python2.7/site-packages (python 2.7)

对于没有sudo的pip -V,它仍然是pip 8.1.2。

此外,当我输入which pipsudo which pip时,两者都会返回/Users/YTQ/anaconda/bin/pip

我可以知道如何解决这个点子升级问题吗?我是否滥用了sudo命令?

0 个答案:

没有答案