简体   繁体   English

不能将pip升级到最新版本9.0.1(操作系统:ubuntu 16.04LTS)

[英]can`t upgrade pip to the newest version 9.0.1 (OS:ubuntu 16.04LTS)

OS: ubuntu 16.04LTS 操作系统: ubuntu 16.04LTS

Python: 2.7.12 + Anaconda2-4.2.0 (64 bit) Python: 2.7.12 + Anaconda2-4.2.0 (64 bit)

I typed pip install --upgrade $TF_BINARY_URL to install tensorflow but terminal showed that my pip verson was 8.1.1 , however version 9.0.1 is available. 我输入了pip install --upgrade $TF_BINARY_URL来安装tensorflow但是终端显示我的pip verson是8.1.1 ,但版本9.0.1可用。

Then I typed pip install --upgrade pip to upgrade but it showed Requirement already up-to-date: pip in ./anaconda2/lib/python2.7/site-packages , 然后我键入pip install --upgrade pip进行升级,但它显示Requirement already up-to-date: pip in ./anaconda2/lib/python2.7/site-packages

I still can't use pip version 9.0.1 to install tensorflow. 我仍然无法使用pip版本9.0.1来安装tensorflow。 Does anyone know what's going on ?? 有谁知道发生了什么?

sudo -H pip install --upgrade pip

sudo is "super user do". sudo是“超级用户做”。 This will allow you to execute commands as a super user. 这将允许您以超级用户身份执行命令。 The H flag tells sudo to keep the home directory of the current user. H标志告诉sudo保留当前用户的主目录。 This way when pip installs things, like pip itself, it uses the appropriate directory. 这种方式当pip安装东西时,比如pip本身,它使用适当的目录。

I had this same problem. 我有同样的问题。 Not sure what is going on. 不确定发生了什么。 I use both python and python3 and have both a pip and a pip3. 我同时使用python和python3并且同时拥有一个pip和一个pip3。 By chance I did the following and it seems to have fixed the problem. 我偶然做了以下事情,似乎解决了这个问题。

pip3 install -U pip pip3安装-U pip

resulting in 导致

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:
  Successfully uninstalled pip-8.1.2
Successfully installed pip-9.0.1

I have the same problem. 我也有同样的问题。 But my python is under /usr/bin . 但我的python/usr/bin I tried sudo -H pip install -U pip , which didn't work. 我试过sudo -H pip install -U pip ,但是sudo -H pip install -U pip However, when I removed the pip installed by system package manager with 但是,当我删除系统包管理器安装的pip

sudo apt-get remove python-pip python3-pip

, the problem was solved. ,问题解决了。 It seems that pip installed with system package manager is not consistent with pip wrapped up with python . 看来, pip与系统包管理器安装不符合一致pip包裹着python

For me none of the above solutions worked, except 对我来说,上述解决方案都没有奏效,除了
easy_install -U pip

UPDATE: easy_install was part of python-setuptools but from version 39.0.1-2 , it is no longer part of it. 更新: easy_installpython-setuptools一部分,但是从版本39.0.1-2 ,它不再是它的一部分。 See changelog . 请参阅changelog

Try updating pip using conda as follows: 尝试使用conda更新pip,如下所示:

conda update pip

Thereafter try installing tensorflow. 然后尝试安装tensorflow。 See this 看到这个

I had same problem BUT because of permission . 我有同样的问题但是因为许可 So simple solution for me: 对我这么简单的解决方案:

sudo pip install --upgrade pip

如果您只是将东西安装到一个用户帐户,也可以使用pip install --user --upgrade pip避免sudo或不sudo ...请注意不要在系统范围内使用该帐户安装pip好吃的东西。

First, a discussion of the relationship between python and pip. 首先,讨论python和pip之间的关系。 Then how to apply that to your Anaconda - tensorflow problem. 然后如何将其应用于您的Anaconda - tensorflow问题。


"Pip" is a python package, meaning it must be run by a python interpreter. “Pip”是一个python包,这意味着它必须由python解释器运行。 The file(s) you see when calling which pip ( which pip3 ) are actually python scripts, and they are effectively aliasing as follows: 在调用which pipwhich pip3 )实际上是python脚本时看到的文件,它们实际上是别名,如下所示:

  • pip ... results in calling python2.7 -m pip ... pip ...导致调用python2.7 -m pip ...

  • pip3 ... results in calling python3.5 -m pip ... pip3 ...导致调用python3.5 -m pip ...

Furthermore, in your environment pip is the alias target of pip2 , 此外,在您的环境中, pippip2的别名目标,

Each version of python has it's own search path, so each version finds a different version of the pip package. 每个版本的python都有自己的搜索路径,因此每个版本都会找到不同版本的pip包。 Moreover, 此外,

when the python2.7/sitepackages/pip is called by python2.7 , it will install in /home/<user>/.local/lib/python2.7/site-packages (or the window equivalent) python2.7/sitepackages/pip由称为python2.7 ,它会在安装/home/<user>/.local/lib/python2.7/site-packages (或窗口当量)

and when the python3.5/site-packages/pip is called by python3.5 , it will install in /home/<user>/.local/lib/python3.5/site-packages (or the window equivalent) python3.5/site-packages/pip被称为python3.5 ,它会在安装/home/<user>/.local/lib/python3.5/site-packages (或窗口等效)

It is impossible for python2.7 to call python3.5/.../pip , and impossible for python3.5 to call python2.7/.../pip - so fortunately we don't even have to consider those combinations, whew! python2.7不可能调用python3.5/.../pip ,并且python3.5不可能调用python2.7/.../pip python3.5 - 幸运的是我们甚至不必考虑这些组合,噢!

Why did your system not want to upgrade the pip in python2.7/.../site-packages ? 为什么你的系统不想升级python2.7/.../site-packagespip My guess is that was by design. 我猜这是设计的。 By the way, are you sure tensorflow is written in python2.7 and not python3.5 ? 顺便说一句,你确定tensorflow是用python2.7而不是python3.5吗?


To get back to your question: I found this link which may be of interest to you: 回到你的问题:我发现了你可能感兴趣的链接:

Installing Tensorflow on windows Anaconda2 在Windows Anaconda2上安装Tensorflow

It appears that the OP was trying to use tensorflow which required python3.5, into Anaconda2 which uses python2.7. 似乎OP试图使用需要python3.5的tensorflow,进入使用python2.7的Anaconda2。

Perhaps you could upgrade to Anaconda3 which uses python3.5? 也许你可以升级到使用python3.5的Anaconda3? (There might be other ways, but upgrading Anaconda seems klike the one with the least liklihood of cross version problems). (可能还有其他方法,但升级Anaconda似乎是最喜欢交叉版本问题的那个)。

Then you install your tensorflow module with 然后安装tensorflow模块

python3 -m pip install tensorflow

cannot install pip 9 for python3 on ubuntu16 with pip or pip3 无法使用pip或pip3在ubuntu16上为python3安装pip 9

solve by: sudo apt-get upgrade python3-pip (here may be run the apt update first.) 解决方法: sudo apt-get upgrade python3-pip (这里可能先运行apt update 。)
pip3 -V pip 9.0.1 from /home/roofe/.local/lib/python3.5/site-packages (python 3.5)


roofe@utnubu:~$ pip install --upgrade pip Collecting pip Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB) 100% |████████████████████████████████| 1.3MB 14kB/s Installing collected packages: pip Successfully installed pip-9.0.1
note: the upper command only successly installed for python2. 注意:只为python2成功安装了upper命令。

roofe@utnubu:~$ pip3 install --upgrade pip3 Collecting pip3 Could not find a version that satisfies the requirement pip3 (from versions: ) No matching distribution found for pip3 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. roofe@utnubu:~$ pip install --upgrade pip3 Collecting pip3 Could not find a version that satisfies the requirement pip3 (from versions: ) No matching distribution found for pip3 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.

Unsurprisingly none of the answers here worked for me either. 不出所料,这里的答案也没有对我有用。 What did work was to go to https://pypi.org/project/pip/9.0.3/#files and download the wheel file. 做了什么工作去https://pypi.org/project/pip/9.0.3/#files并下载轮文件。 Then I ran pip install --user pip-9.0.3-py2.py3-none-any.whl . 然后我运行了pip install --user pip-9.0.3-py2.py3-none-any.whl That successfully got me to 9.0.3 . 那成功地让我达到9.0.3

After that I did pip install --user --upgrade and it successfully upgraded me to 10.0.0 . 之后我做了pip install --user --upgrade并成功将我升级到10.0.0 I suppose I could have directly installed 10.0.0 but I also wanted to double check that there wasn't anything else wrong in the chain. 我想我可以直接安装10.0.0但我也想仔细检查链中没有其他错误。

Anyway, here is where you can download the latest pip: https://pypi.org/project/pip/#files 无论如何,在这里你可以下载最新的点子: https//pypi.org/project/pip/#files

This is not an actual solution, but the output of the commands above, and who knows, maybe useful for some 这不是一个实际的解决方案,但上面命令的输出,谁知道,可能对某些人有用

To sum up what's going on here. 总结一下这里发生了什么。 The system is a Raspbian 8 Jessie LITE running on a Raspberry Pi 3 meta B, so in short, it's a Debian based Linux OS just like Ubuntu. 该系统是在Raspberry Pi 3 meta B上运行的Raspbian 8 Jessie LITE,简而言之,它就像Ubuntu一样是基于Debian的Linux操作系统。

On this system the command pip install --upgrade pip doesn't do the job. 在这个系统上,命令pip install --upgrade pip不能完成这项工作。 My thinking is it just simply can't do it because of the required Debian packages which are installed with the sudo apt-get upgrade python-pip command (about 27MB). 我的想法是它只是根本无法做到这一点,因为所需的Debian软件包与sudo apt-get upgrade python-pip命令一起安装(大约27MB)。 Pip just simply not allowed to upgrade Debian packages. Pip只是不允许升级Debian软件包。

I think the source of difference in results for the self-updating command is a minor version difference which doesn't need system level upgrade can be done like that but every other case will require an actual software upgrade, but I may be wrong. 我认为自我更新命令的结果差异来源是一个次要的版本差异,不需要系统级升级就可以这样做但是其他每种情况都需要实际的软件升级,但我可能错了。 Based on my little investigation the correct solution for Debian Linux is: 基于我的小调查,Debian Linux的正确解决方案是:
sudo apt-get upgrade python-pip
or 要么
sudo apt-get upgrade python3-pip
as others stated before. 正如其他人之前所说。

    pi@lalaland:~ $ pip show pip
    ---
    Name: pip
    Version: 1.5.6
    Location: /usr/lib/python2.7/dist-packages
    Requires: 

    pi@lalaland:~ $ pip3 show pip
    ---
    Name: pip
    Version: 1.5.6
    Location: /usr/lib/python3/dist-packages
    Requires: 

    pi@lalaland:~ $ sudo pip install --upgrade pip
    Downloading/unpacking pip from https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl#sha256=717cdffb2833be8409433a93746744b59505f42146e8d37de6c62b430e25d6d7
      Downloading pip-10.0.1-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded
    Installing collected packages: pip
      Found existing installation: pip 1.5.6
        Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS
    Successfully installed pip
    Cleaning up...

    pi@lalaland:~ $ pip show pip
    ---
    Name: pip
    Version: 1.5.6
    Location: /usr/lib/python2.7/dist-packages
    Requires: 

    pi@lalaland:~ $ pip3 show pip
    ---
    Name: pip
    Version: 1.5.6
    Location: /usr/lib/python3/dist-packages
    Requires: 

    pi@lalaland:~ $ sudo pip3 install --upgrade pip
    Downloading/unpacking pip from https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl#sha256=717cdffb2833be8409433a93746744b59505f42146e8d37de6c62b430e25d6d7
      Downloading pip-10.0.1-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded
    Installing collected packages: pip
      Found existing installation: pip 1.5.6
        Not uninstalling pip at /usr/lib/python3/dist-packages, owned by OS
    Successfully installed pip
    Cleaning up...

    pi@lalaland:~ $ pip show pip
    ---
    Name: pip
    Version: 1.5.6
    Location: /usr/lib/python2.7/dist-packages
    Requires: 

    pi@lalaland:~ $ pip3 show pip
    ---
    Name: pip
    Version: 1.5.6
    Location: /usr/lib/python3/dist-packages
    Requires: 

    pi@lalaland:~ $ pip -version

    Usage:   
      pip <command> [options]

    no such option: -e

    pi@lalaland:~ $ pip --version
    pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)

    pi@lalaland:~ $ pip3 --version
    pip 1.5.6 from /usr/lib/python3/dist-packages (python 3.4)

The commands seem to have no effect what so ever. 这些命令似乎没有任何影响。
So time to try to upgrade pip with apt-get . 所以是时候尝试用apt-get升级pip了。

    pi@lalaland:~ $ sudo apt-get upgrade python-pip
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Calculating upgrade... python-pip is already the newest version.
    Done
    The following packages have been kept back:
      python-openssl python3-openssl
    The following packages will be upgraded:
      curl git git-core git-man gnupg gnupg-agent gnupg2 gpgv libcurl3 libcurl3-gnutls libicu52 libmad0 libperl5.20 libpoppler46
      libprocps3 libsdl-image1.2 libsnmp-base libsnmp30 libssl1.0.0 libvorbis0a libvorbisenc2 libvorbisfile3 openssl perl perl-base
      perl-modules poppler-utils procps wget xdg-utils
    30 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
    Need to get 27.2 MB of archives.
    After this operation, 731 kB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libperl5.20 armhf 5.20.2-3+deb8u11 [1,348 B]
    :
    Get:30 http://mirrordirector.raspbian.org/raspbian/ jessie/main xdg-utils all 1.1.0~rc1+git20111210-7.4+deb8u1 [65.1 kB]             
    Fetched 27.2 MB in 15s (1,767 kB/s)                                                                                                  
    Reading changelogs... Done
    Preconfiguring packages ...
    :
    Setting up xdg-utils (1.1.0~rc1+git20111210-7.4+deb8u1) ...
    Processing triggers for libc-bin (2.19-18+deb8u10) ...

    pi@lalaland:~ $ pip show pip
    ---
    Name: pip
    Version: 1.5.6
    Location: /usr/lib/python2.7/dist-packages
    Requires: 

    pi@lalaland:~ $ pip3 show pip
    ---
    Name: pip
    Version: 1.5.6
    Location: /usr/lib/python3/dist-packages
    Requires: 

    pi@lalaland:~ $ pip --version
    pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)

    pi@lalaland:~ $ pip3 --version
    pip 1.5.6 from /usr/lib/python3/dist-packages (python 3.4)

    pi@lalaland:~ $ sudo pip install --upgrade pip
    Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages (10.0.1)

    pi@lalaland:~ $ sudo pip3 install --upgrade pip
    Cache entry deserialization failed, entry ignored
    Requirement already up-to-date: pip in /usr/local/lib/python3.4/dist-packages (10.0.1)

at this point pip --version and pip3 --version still returns wrong version numbers. 在这一点上, pip --versionpip3 --version仍然返回错误的版本号。
Although after a soft-reboot ( sudo init 6 ): 虽然经过软重启( sudo init 6 ):

    pi@lalaland:~ $ sudo init 6

    pi@lalaland:~ $ pip show pip
    Name: pip
    Version: 10.0.1
    Summary: The PyPA recommended tool for installing Python packages.
    Home-page: https://pip.pypa.io/
    Author: The pip developers
    Author-email: python-virtualenv@groups.google.com
    License: MIT
    Location: /usr/local/lib/python2.7/dist-packages
    Requires: 
    Required-by: 

    pi@lalaland:~ $ pip3 show pip
    Name: pip
    Version: 10.0.1
    Summary: The PyPA recommended tool for installing Python packages.
    Home-page: https://pip.pypa.io/
    Author: The pip developers
    Author-email: python-virtualenv@groups.google.com
    License: MIT
    Location: /usr/local/lib/python3.4/dist-packages
    Requires: 
    Required-by: 

    pi@lalaland:~ $ pip --version
    pip 10.0.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

    pi@lalaland:~ $ pip3 --version
    pip 10.0.1 from /usr/local/lib/python3.4/dist-packages/pip (python 3.4)

All version numbers are fine. 所有版本号都没问题。

I removed the pip installed by system package manager 我删除了系统包管理器安装的pip

sudo apt-get remove python-pip

than I needed to dwonload it from the dist page 比我需要从dist页面下载它

cd ~/Downloads
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

that solved the problem 这解决了问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM