![Pip 安装出现异常行为(没有失败,但也没有工作)](https://linux22.com/image/890313/Pip%20%E5%AE%89%E8%A3%85%E5%87%BA%E7%8E%B0%E5%BC%82%E5%B8%B8%E8%A1%8C%E4%B8%BA%EF%BC%88%E6%B2%A1%E6%9C%89%E5%A4%B1%E8%B4%A5%EF%BC%8C%E4%BD%86%E4%B9%9F%E6%B2%A1%E6%9C%89%E5%B7%A5%E4%BD%9C%EF%BC%89.png)
我一直在尝试使用 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.
此外,可能相关,我正在尝试安装matplotlib
并pip 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
。
现在两个命令都可以正常运行。