折腾:
【未解决】Mac中pyenv安装和设置python 3.7为系统python
期间,
去用pyenv install去安装python:
➜ ~ pyenv install 3.7.3 python-build: use openssl from homebrew python-build: use readline from homebrew Downloading Python-3.7.3.tar.xz... -> https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
卡死没进度了。
算了,去给pip加速,换源,或者临时加代理
还是换源吧:
【未解决】Mac中给pip更换源以加速下载
然后重新去安装试试,看看下载的python安装包,是否更换了源,是否加速了
➜ ~ python --version Python 3.6.6 ➜ ~ pyenv install -v 3.7.3 python-build: use openssl from homebrew python-build: use readline from homebrew /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/python-build.20200227211556.54131 ~ Downloading Python-3.7.3.tar.xz... -> https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
结果:
并不能:
此处pyenv安装的python,还是从python.org下载的。
然后尝试加上临时的代理试试能否加速
太慢,中断:
➜ ~ pyenv install -v 3.7.3 python-build: use openssl from homebrew python-build: use readline from homebrew /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/python-build.20200227211556.54131 ~ Downloading Python-3.7.3.tar.xz... -> https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz ^Cerror: failed to download Python-3.7.3.tar.xz BUILD FAILED (OS X 10.15.2 using python-build 20180424) Inspect or clean up the working tree at /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/python-build.20200227211556.54131 Results logged to /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/python-build.20200227211556.54131.log Last 10 log lines: /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/python-build.20200227211556.54131 ~ /usr/local/bin/python-build: line 2304: kill: (54172) - No such process
去找找,是否有其他办法能给pyenv install加速
pyenv speed up proxy
* Proxy note: If you use a proxy, export http_proxy and HTTPS_PROXY too.
好像可以加代理?
去试试
此处
https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
是https,先去加上https的,试试
先看看本地代理:
所以去试试
➜ ~ HTTPS_PROXY=http://127.0.0.1:1087 ➜ ~ echo $HTTPS_PROXY http://127.0.0.1:1087
再去试试,看看速度能否变化
➜ ~ pyenv install -v 3.7.3 python-build: use openssl from homebrew python-build: use readline from homebrew /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/python-build.20200227212342.54865 ~ Downloading Python-3.7.3.tar.xz... -> https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
好像没变化还是很慢。
NOTE: If you want to use proxy to download, please use http_proxy and https_proxy environment variable.
那也再去加上http_proxy
➜ ~ HTTP_PROXY=http://127.0.0.1:1087 ➜ ~ echo $HTTP_PROXY http://127.0.0.1:1087
再去试试
➜ ~ pyenv install -v 3.7.3 python-build: use openssl from homebrew python-build: use readline from homebrew /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/python-build.20200227212522.55477 ~ Downloading Python-3.7.3.tar.xz... -> https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
还是看不出速度是否有加速。。。
试了试把v2ray的代理关闭了,结果也不影响。。。
说明代理没有效果。
➜ ~ http_proxy=http://127.0.01:1087 ➜ ~ https_proxy=http://127.0.01:1087 ➜ ~ echo $http_proxy http://127.0.01:1087 ➜ ~ echo $https_proxy http://127.0.01:1087
结果:问题依旧。断了代理,依旧没影响下载。
只不过下载还是没速度,很慢。
试试手动下载,放到合适位置
~/.pyenv/cache/
发现已有:
➜ ~ mkdir ~/.pyenv/cache/ mkdir: /Users/crifan/.pyenv/cache/: File exists ➜ ~ ll ~/.pyenv/cache/ total 33576 -rw-r--r--@ 1 crifan staff 16M 6 27 2018 Python-3.6.6.tar.xz
说明是对的。
单独手动下载:
选了香港节点,速度快很多了,得到200多KB
➜ ~ cd ~/.pyenv/cache ➜ cache ll total 68456 -rw-r--r--@ 1 crifan staff 16M 6 27 2018 Python-3.6.6.tar.xz -rw-r--r--@ 1 crifan staff 16M 2 27 21:32 Python-3.7.3.tar.xz
再继续安装
➜ cache pyenv install -v 3.7.3 python-build: use openssl from homebrew python-build: use readline from homebrew /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/python-build.20200227213416.57009 ~/.pyenv/cache /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/python-build.20200227213416.57009/Python-3.7.3 /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/python-build.20200227213416.57009 ~/.pyenv/cache Installing Python-3.7.3... python-build: use readline from homebrew 。。。
可以继续安装了。
不用等待下载了。
【总结】
问题:此处
pyenv install -v 3.7.3
很慢。
解决办法:
手动下载python安装包,放到cache中,即可。
(1)python安装包的路径:可以从log中看出,此处是:
(2)cache位置:
~/.pyenv/cache
如果没有,则自己创建一下:
mkdir ~/.pyenv/cache
【后记】
pyenv proxy
有人说了:
https_proxy=socks5://127.0.0.1:1080 pyenv install -v 3.5.2
是可以的。抽空,有空,再去试试。
转载请注明:在路上 » 【已解决】Mac中如何给pyenv install加速