在Mac OS中,在終端中利用命令
export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;
讓當前終端走Shadowsockes的代理,但是通過sudo執行仍然走的是原來的老路。
比如使用pip命令就會出現這樣的情況:
sudo pip install frida-tools
Downloading https://files.pythonhosted.org/packages/d1/b0/1a6c262da35c779dd79550137aa7c298a424987240a28792ec5ccf48f848/prompt_toolkit-1.0.15-py2-none-any.whl (247kB)
45% |██████████████▌ | 112kB 1.2kB/s eta 0:01:50Exception:
Traceback (most recent call last):
..............
ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
WTF!!!!!
這個時候,你就會發現這篇文章的價值了。。
解決方法是:
打開訪達(finder),選擇前往-前往文件夾,輸入/etc
找到sudoers文件,用Sublime Text(一個非常好用的文本編輯器)打開,然後加入
Defaults env_keep += "http_proxy https_proxy no_proxy"
至於加在哪裏,你打開這個文件之後自己就能看出來了。。。
保存並退出。
這個文件是隻讀的,需要右鍵-顯示簡介-改權限,另外一定不要用系統的文本編輯,不然就算改了權限它也不會讓你寫該文件,用Sublime Text,改完之後直接command+S保存,。
新建終端,還是要先讓終端走代理,然後再來一遍pip:
sudo pip install frida-tools
Downloading https://files.pythonhosted.org/packages/d1/b0/1a6c262da35c779dd79550137aa7c298a424987240a28792ec5ccf48f848/prompt_toolkit-1.0.15-py2-none-any.whl (247kB)
100% |████████████████████████████████| 256kB 872kB/s
Requirement already satisfied: pygments<3.0.0,>=2.0.2 in /usr/local/lib/python2.7/site-packages (from frida-tools) (2.2.0)
Requirement already satisfied: wcwidth in /usr/local/lib/python2.7/site-packages (from prompt-toolkit<2.0.0,>=0.57->frida-tools) (0.1.7)
Requirement already satisfied: six>=1.9.0 in /usr/local/lib/python2.7/site-packages (from prompt-toolkit<2.0.0,>=0.57->frida-tools) (1.11.0)
Installing collected packages: prompt-toolkit
Found existing installation: prompt-toolkit 2.0.3
Uninstalling prompt-toolkit-2.0.3:
Successfully uninstalled prompt-toolkit-2.0.3
Successfully installed prompt-toolkit-1.0.15
這速度簡直是天壤之別啊。。