升级pip您正在使用pip版本7.1.2到版本8.1.2

时间:2016-10-13 19:38:10

标签: python terminal install pip

您好我正在尝试将我的点数版本升级到8.1.2 此命令不起作用:     pip install --upgrade pip

我也尝试直接从github目录中获取它,就像这里解释https://github.com/pypa/pip/archive/8.1.1.zip但是我得到以下错误:

Checking .pth file support in /Library/Python/2.7/site-packages/
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-21442.pth'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /Library/Python/2.7/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  https://pythonhosted.org/setuptools/easy_install.html

Please make the appropriate changes for your system and try again.

我正在使用Mac btw

3 个答案:

答案 0 :(得分:0)

尝试以管理员身份打开命令提示符,然后尝试升级它,应该可行。

答案 1 :(得分:0)

您的问题是您的用户没有/Library/Python/2.7/site-packages目录的写权限。这就是[Errno 13] Permission denied

的含义

尝试使用sudo前缀原始命令的命令运行。 Sudo允许您以root身份安全地运行程序。您需要在提示符下键入密码。

答案 2 :(得分:0)

您可以通过以下方式进行跟进:

pip install -U pip
sudo !!

这与以下效果相同:

sudo pip install -U pip

甚至更好,远离OS X的Python安装,而是通过Homebrew安装Python / pip:

brew install python
brew install python3