简体   繁体   中英

pip install not working windows 7

I have downloaded pip frpm https://sites.google.com/site/pydatalog/python/pip-for-windows

Now when I type any package name or upgrade in the command section I get the following error

Downloading https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
Traceback (most recent call last):

 File "C:\Python33\lib\urllib\request.py", line 1248, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "C:\Python33\lib\http\client.py", line 1065, in request
    self._send_request(method, url, body, headers)
  File "C:\Python33\lib\http\client.py", line 1103, in _send_request
    self.endheaders(body)
  File "C:\Python33\lib\http\client.py", line 1061, in endheaders
    self._send_output(message_body)
  File "C:\Python33\lib\http\client.py", line 906, in _send_output
    self.send(msg)
  File "C:\Python33\lib\http\client.py", line 844, in send
    self.connect()
  File "C:\Python33\lib\http\client.py", line 1198, in connect
    self.timeout, self.source_address)
  File "C:\Python33\lib\socket.py", line 435, in create_connection
    raise err
  File "C:\Python33\lib\socket.py", line 426, in create_connection
    sock.connect(sa)
TimeoutError: [WinError 10060] A connection attempt failed because the connected
 party did not properly respond after a period of time, or established connectio
n failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Admin~1\AppData\Local\Temp\rmv_setup.py", line 60, in <module>

    download(url, "ez_setup.py")
  File "C:\Users\Admin~1\AppData\Local\Temp\rmv_setup.py", line 30, in download

    src = urlopen(url)
  File "C:\Python33\lib\urllib\request.py", line 156, in urlopen
    return opener.open(url, data, timeout)
urllib.error.URLError: <urlopen error [WinError 10060] A connection attempt fail
ed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to respond>

I am behind a proxy. but I can access bitbucket.org through browser. How can I fix this issue?

Considering that you successfully installed pip and now you are trying to install another module using pip.

pip has "proxy" option.Please try to use it and check whether it is helpful.

C:\Users\Administrator\Desktop>pip --help

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  zip                         DEPRECATED. Zip individual packages.
  unzip                       DEPRECATED. Unzip individual packages.
  bundle                      DEPRECATED. Create pybundles.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  -v, --verbose               Give more output. Option is additive, and can be
                              used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output.
  --log-file <path>           Path to a verbose non-appending log, that only
                              logs failures. This log is active by default at
                              C:\Users\Administrator\pip\pip.log.
  --log <path>                Path to a verbose appending log. This log is
                              inactive by default.
  --proxy <proxy>             Specify a proxy in the form
                              [user:passwd@]proxy.server:port.
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists:
                              (s)witch, (i)gnore, (w)ipe, (b)ackup.
  --cert <path>               Path to alternate CA bundle.

C:\Users\Administrator\Desktop>

This is more like a comment than an answer. If your access to internet is through the proxy, ie you have no access to internet except establishing the proxy, then pip/pip3 won't be able to download the files. Try ping google.com if you see no response then try installing an application like proxyfire to enforce the proxy settings across the entire system.

Hope it helps.

Error 10060 means it cannot connect to the remote peer.
You probably want to check if ping and telnet work through port 80. If only ping works and telnet doesn't, then HTTP port 80 is closed on your machine.

You can try to connect through another tool such as ncat

I know there exists a function in the urllib2 library that will allow you to handle proxy support which is something like:

import urllib2 proxy_handle = urllib2.ProxyHandler({"http":"http://123.124.125.126:80"}) opener = urllib2.build_opener(proxy_handle) urllib2.install_opener(opener)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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