Pip 安装出现异常行为(没有失败,但也没有工作)

Pip 安装出现异常行为(没有失败,但也没有工作)

我一直在尝试使用 pip 8.1.1 进行升级pip install --upgrade pip。该命令没有失败,但也没有执行任何操作。输出是

Collecting pip
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 615kB/s 
Installing collected packages: pip
  Found existing installation: pip 8.1.1
    Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-8.1.1
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

此外,可能相关,我正在尝试安装matplotlibpip install matplotlib==2.0.0得到以下结果:

Collecting matplotlib==2.0.0
  Downloading matplotlib-2.0.0-1-cp27-cp27mu-manylinux1_x86_64.whl (14.6MB)
    100% |████████████████████████████████| 14.6MB 94kB/s 
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.1 in /usr/lib/python2.7/dist-packages (from matplotlib==2.0.0)
Collecting cycler>=0.10 (from matplotlib==2.0.0)
  Using cached cycler-0.10.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/lib/python2.7/dist-packages (from matplotlib==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): functools32 in /usr/local/lib/python2.7/dist-packages (from matplotlib==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): six>=1.10 in /usr/lib/python2.7/dist-packages (from matplotlib==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): pytz in /usr/lib/python2.7/dist-packages (from matplotlib==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): pyparsing!=2.0.0,!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 in /usr/lib/python2.7/dist-packages (from matplotlib==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): subprocess32 in /usr/local/lib/python2.7/dist-packages (from matplotlib==2.0.0)
Installing collected packages: cycler, matplotlib
  Found existing installation: cycler 0.9.0
    Not uninstalling cycler at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed cycler-0.9.0 matplotlib-2.0.0
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

matplotlib但由于cycler版本不是最新的,我无法导入。

所以我猜关键是Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr信息,但我不知道那是什么意思。

答案1

我不太明白这是什么原因,但显然这是因为 pip 是通过安装的,apt而我正尝试用 pip 升级它。所以解决方案是删除 pip viaapt并使用获取pip.py,它独立于apt

现在两个命令都可以正常运行。

相关内容