pyenv下载官方python版本速度慢解决方法

pyenv下载官方python版本速度慢解决方法

使用默认的pyenv install python 版本号 的方式安装,国内下载速度太慢,有时还会中断。

可以先使用国内的python镜像网站下载好对应的python tar.xz包,放置于$HOME/.pyenv/cache/目录下,然后再使用安装命令安装的曲线方案。

命令行一键安装如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[Wed Jun 03 talen@tp ~]$ version="2.7.16"; echo $version; wget "https://mirrors.huaweicloud.com/python/$version/Python-$version.tar.xz" -P ~/.pyenv/cache/;pyenv install $version
2.7.16
--2020-06-03 21:15:36-- https://mirrors.huaweicloud.com/python/2.7.16/Python-2.7.16.tar.xz
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving mirrors.huaweicloud.com (mirrors.huaweicloud.com)... 117.78.24.36, 117.78.24.32, 117.78.24.34
Connecting to mirrors.huaweicloud.com (mirrors.huaweicloud.com)|117.78.24.36|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12752104 (12M) [application/octet-stream]
Saving to: ‘/home/talen/.pyenv/cache/Python-2.7.16.tar.xz’

Python-2.7.16.tar.xz 100%[=============================================================>] 12.16M 8.91MB/s in 1.4s

2020-06-03 21:15:37 (8.91 MB/s) - ‘/home/talen/.pyenv/cache/Python-2.7.16.tar.xz’ saved [12752104/12752104]

Installing Python-2.7.16...
Installed Python-2.7.16 to /home/talen/.pyenv/versions/2.7.16

然后就可以愉快的工作了

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

[Wed Jun 03 talen@tp ~]$ pyenv shell 2.7.16
[Wed Jun 03 talen@tp ~]$ pyenv virtualenvwrapper_lazy
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting virtualenvwrapper
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c1/6b/2f05d73b2d2f2410b48b90d3783a0034c26afa534a4a95ad5f1178d61191/virtualenvwrapper-4.8.4.tar.gz (334kB)
...

[Wed Jun 03 talen@tp ~]$ pyenv version
2.7.16 (set by PYENV_VERSION environment variable)
[Wed Jun 03 talen@tp ~]$ workon
anaconda
beibei
beibei_capacity
beibei_es_log
celery
diagrams-on-python
django_celery_ansible
djangoreactproject
django-rest
dns_healthcheck
dnsmonitor
fly_ops
graph
jumpserver
leetcode
log4p
mxshop
sklearn_study
spider
study
study-xfz
test_relocatable
坚持原创技术分享,您的支持将鼓励我继续创作!