如何在ubuntu 14.04 LTS上安装pip?我在安装时遇到了这个错误

时间:2016-05-16 06:17:59

标签: python pip

我试过这个命令:

kv@kv:~$ sudo easy_install pip

我收到此错误:

Searching for pip
Reading https://pypi.python.org/simple/pip/
Download error on https://pypi.python.org/simple/pip/: [Errno 111] Connection refused -- Some packages may not be found!
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [Errno 111] Connection refused -- Some packages may not be found!
No local packages or download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')

错误:

The directory '/home/kv/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/kv/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f128ae75a10>: Failed to establish a new connection: [Errno 111] Connection refused',)': /simple/pip/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f128ae75b90>: Failed to establish a new connection: [Errno 111] Connection refused',)': /simple/pip/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f128ae75ed0>: Failed to establish a new connection: [Errno 111] Connection refused',)': /simple/pip/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f128ae75190>: Failed to establish a new connection: [Errno 111] Connection refused',)': /simple/pip/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f128ae754d0>: Failed to establish a new connection: [Errno 111] Connection refused',)': /simple/pip/
  Could not find a version that satisfies the requirement pip (from versions: )
No matching distribution found for pip

ERROR2

kv@kv:~$ sudo pip install --upgrade pip

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2749, in <module>
        working_set = WorkingSet._build_master()
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 446, in _build_master
        return cls._build_from_requirements(__requires__)
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 459, in _build_from_requirements
        dists = ws.resolve(reqs, Environment())
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 628, in resolve
        raise DistributionNotFound(req)
    pkg_resources.DistributionNotFound: pip==1.0

3 个答案:

答案 0 :(得分:0)

从主机到pypi的连接失败。这与pythonpipeasy_install无关。你要做的是正确的。

在您重新安装之前,您必须解决网络问题。

为了更快地检查,您可以curl https://pypi.python.org/simple/pip/。获得文件列表后,请再次尝试使用easy_install

可能是pypi存储库暂时不可用。如果您可以从该主机访问Google,请稍等一会儿再重试。

答案 1 :(得分:-2)

sudo apt-get install python-pip

答案 2 :(得分:-2)

命令

sudo apt-get install python-pip

输出

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libpython-all-dev python-all python-all-dev
The following NEW packages will be installed:
  libpython-all-dev python-all python-all-dev python-pip
0 upgraded, 4 newly installed, 0 to remove and 78 not upgraded.
Need to get 147 kB of archives.
After this operation, 651 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 libpython-all-dev amd64 2.7.11-1 [992 B]
Get:2 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 python-all amd64 2.7.11-1 [978 B]
Get:3 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 python-all-dev amd64 2.7.11-1 [1,000 B]
Get:4 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 python-pip all 8.1.1-2 [144 kB]
Fetched 147 kB in 4s (34.2 kB/s)     
Selecting previously unselected package libpython-all-dev:amd64.
(Reading database ... 362359 files and directories currently installed.)
Preparing to unpack .../libpython-all-dev_2.7.11-1_amd64.deb ...
Unpacking libpython-all-dev:amd64 (2.7.11-1) ...
Selecting previously unselected package python-all.
Preparing to unpack .../python-all_2.7.11-1_amd64.deb ...
Unpacking python-all (2.7.11-1) ...
Selecting previously unselected package python-all-dev.
Preparing to unpack .../python-all-dev_2.7.11-1_amd64.deb ...
Unpacking python-all-dev (2.7.11-1) ...
Selecting previously unselected package python-pip.
Preparing to unpack .../python-pip_8.1.1-2_all.deb ...
Unpacking python-pip (8.1.1-2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libpython-all-dev:amd64 (2.7.11-1) ...
Setting up python-all (2.7.11-1) ...
Setting up python-all-dev (2.7.11-1) ...
Setting up python-pip (8.1.1-2) ...
相关问题