如何在PAC Proxy后面使用Anaconda PIP

时间:2016-09-29 02:40:49

标签: python proxy pip anaconda conda

我坐在代理服务器后面。 代理是使用PAC文件实现的。 我想使用pip安装软件包但由于代理无法安装。 以下是我的pip.log

中的错误
> Exception information: Traceback (most recent call last):   File
> "C:\Anaconda\lib\site-packages\pip\basecommand.py", line 134, in main
>     status = self.run(options, args)   File "C:\Anaconda\lib\site-packages\pip\commands\install.py", line 236, in
> run
>     requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)   File
> "C:\Anaconda\lib\site-packages\pip\req.py", line 1085, in
> prepare_files
>     url = finder.find_requirement(req_to_install, upgrade=self.upgrade)   File
> "C:\Anaconda\lib\site-packages\pip\index.py", line 201, in
> find_requirement
>     page = self._get_page(main_index_url, req)   File "C:\Anaconda\lib\site-packages\pip\index.py", line 554, in _get_page
>     return HTMLPage.get_page(link, req, cache=self.cache)   File "C:\Anaconda\lib\site-packages\pip\index.py", line 671, in get_page
>     resp = urlopen(url)   File "C:\Anaconda\lib\site-packages\pip\download.py", line 176, in __call__
>     response = self.get_opener(scheme=scheme).open(url)   File "C:\Anaconda\lib\urllib2.py", line 404, in open
>     response = self._open(req, data)   File "C:\Anaconda\lib\urllib2.py", line 422, in _open
>     '_open', req)   File "C:\Anaconda\lib\urllib2.py", line 382, in _call_chain
>     result = func(*args)   File "C:\Anaconda\lib\site-packages\pip\download.py", line 155, in
> https_open
>     return self.do_open(self.specialized_conn_class, req)   File "C:\Anaconda\lib\urllib2.py", line 1181, in do_open
>     h.request(req.get_method(), req.get_selector(), req.data, headers)   File "C:\Anaconda\lib\httplib.py", line 973, in request
>     self._send_request(method, url, body, headers)   File "C:\Anaconda\lib\httplib.py", line 1007, in _send_request
>     self.endheaders(body)   File "C:\Anaconda\lib\httplib.py", line 969, in endheaders
>     self._send_output(message_body)   File "C:\Anaconda\lib\httplib.py", line 829, in _send_output
>     self.send(msg)   File "C:\Anaconda\lib\httplib.py", line 791, in send
>     self.connect()   File "C:\Anaconda\lib\site-packages\pip\download.py", line 122, in connect
>     sock = socket.create_connection((self.host, self.port), **self.connection_kwargs)   File "C:\Anaconda\lib\socket.py", line 562, in create_connection
>     sock.connect(sa) KeyboardInterrupt

1 个答案:

答案 0 :(得分:0)

下载您的PAC代理文件

您可以轻松确定哪个是适合您的代理

按如下所示将其添加到您的 .condarc 文件中

proxy_servers:
    http: http://ip-address:port
    https: http://ip-address:port