在代理后面使用Jupyter [英] Using Jupyter behind a proxy

查看:186
本文介绍了在代理后面使用Jupyter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在与.condarc(anaconda 4.0.0)类似的配置,该配置允许Jupyter配置为在本地计算机上的公司代理后面工作?

Is there a similar config to that of .condarc (anaconda 4.0.0) that allows Jupyter to be configured to work behind a corporate proxy on a local machine?

收到错误:

HTTPError: HTTP Error 407: Proxy Authentication Required

推荐答案

更简单:只需将以下内容添加到笔记本中即可:

Way easier: Just add the following to your notebook:

In [1]: import os
        os.environ['http_proxy'] = "http://user:passwd@host:port" 
        os.environ['https_proxy'] = "https://user:passwd@host:port" 

此后,请求将正常运行确定= 200 ,例如

after that, requests will work OK=200, e.g.

In [2]: import requests
        requests.get("http://google.com")
Out[2]: <Response [200]>

这篇关于在代理后面使用Jupyter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆