pip无法在代理后面安装软件包

时间:2015-06-23 08:09:10

标签: python-2.7 proxy pip

是python的新手。作为我的项目设置的一部分,我尝试使用pip作为

安装soem python包
pip install --proxy="uname:pwd@ip:port" pymssql

但是我正在关注pip.log中的日志

page http://pypi.python.org/simple/pymssql
  Could not fetch URL http://pypi.python.org/simple/pymssql: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>
  Will skip URL http://pypi.python.org/simple/pymssql when looking for download links for pymssql
  Getting page http://pypi.python.org/simple/
  Could not fetch URL http://pypi.python.org/simple/: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>
  Will skip URL http://pypi.python.org/simple/ when looking for download links for pymssql
  Cannot fetch index base URL http://pypi.python.org/simple/
  URLs to search for versions for pymssql:
  * http://pypi.python.org/simple/pymssql/
  Getting page http://pypi.python.org/simple/pymssql/
  Could not fetch URL http://pypi.python.org/simple/pymssql/: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>
  Will skip URL http://pypi.python.org/simple/pymssql/ when looking for download links for pymssql
  Could not find any downloads that satisfy the requirement pymssql
No distributions at all found for pymssql
Exception information:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip\basecommand.py", line 126, in main
    self.run(options, args)
  File "C:\Python27\lib\site-packages\pip\commands\install.py", line 223, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "C:\Python27\lib\site-packages\pip\req.py", line 954, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "C:\Python27\lib\site-packages\pip\index.py", line 152, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for pymssql

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

只需在您的环境(Linux或Windows)上设置这2个变量:

http_proxy    http://user:passarod@proxy:port
https_proxy    http://user:passarod@proxy:port