How to get pip to work behind a proxy server [dupl

2019-01-16 18:18发布

This question already has an answer here:

I am trying to use python package manager pip to install a package and it's dependencies from the internet. However I am behind a proxy in my college and have already set the http_proxy environment variable. But when I try to install a package like this:

pip install TwitterApi

I get this error in the log file:

Getting page http://pypi.python.org/simple/TwitterApi
Could not fetch URL http://pypi.python.org/simple/TwitterApi: <urlopen error [Errno 111] Connection refused>
Will skip URL http://pypi.python.org/simple/TwitterApi when looking for download links for TwitterApi
Getting page http://pypi.python.org/simple/
Could not fetch URL http://pypi.python.org/simple/: <urlopen error [Errno 111] Connection refused>

I even tried setting my proxy variable explicitly like this:

pip install --proxy http://user:password@proxyserver:port TwitterApi

But I still get the same error. How do I get pip to work behind a proxy server.

标签: python proxy pip
7条回答
我想做一个坏孩纸
2楼-- · 2019-01-16 18:52

First Try to set proxy using the following command

SET HTTPS_PROXY=http://proxy.***.com:PORT#

Then Try using the command

pip install ModuleName
查看更多
登录 后发表回答