Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Julia 用代理的问题 #1

Closed
zhaiyusci opened this issue Apr 23, 2021 · 0 comments
Closed

Julia 用代理的问题 #1

zhaiyusci opened this issue Apr 23, 2021 · 0 comments

Comments

@zhaiyusci
Copy link
Owner

用 Julia 一个重要的痛点就是网络连接,例如很多单位和本单位一样有内外网问题。

自行配置 V2RayN。其他部分怎么弄,那是读者自己的事。注意以下要点。

  1. 注意调出来圈2处的HTTP监听端口(如果是新版,应该自动就有,旧版需要在系统托盘菜单里调一下)。libgit2 似乎不支持 socks 协议,故http的端口是必需的。

图片

  1. 以我图中的配置为例,打开Julia REPL,输入
ENV["https_proxy"]="http://127.0.0.1:10809/"

大部分系统这样就可以了。当然你可能不是 Windows + V2RayN的组合……

但是我只能跟你讲述我踩过的坑。我没踩过的,我说不出来。

WSL2 用户注意

图片

WSL2 环境可以被简单理解为虚拟机。如果你用的还是V2RayN,并且装在了Windows宿主机里,那么按照上图把圈2处的钩打上。然后去WSL环境,在自己的.bashrc里写

# add to bashrc
alias pjulia='https_proxy="http://$(cat /etc/resolv.conf | grep nameserver | awk "{ print \$2 }"):10809" julia'

当然请根据自己的端口情况改上面的10809

重新进入WSL环境,打开 pjulia,可以查看到ENV["https_proxy"]的值。简单来说,上面写在.bashrc里的咒语可以侦测宿主机的IP,然后从WSL里面访问外部的代理。

我衷心地期望本文是速朽的。一盼 Julia 官方提出更简单的方法,二盼某些技术不进步的单位不要搞内外网了,烦死了。


主要参考资料:

Julia connection to server behind proxy

WSL2 cannot access Windows proxy · Issue #4402 · microsoft/WSL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant