怎么安装 Python2 环境

邹业盛 2024-05-17 22:43 更新

从官方网站下载源码:

https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz

在有 gccmake 的环境上编译:

./configure --prefix=/home/zys/opt/python2

不要加 --enable-optimizations ,加了的话,编译完之后会跑测试,测试中有涉及 SSL 的用例可能会过不了。

2.7.18 这个版本是没有自带 pip ,还需要自己安装一下。

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
python2 get-pip.py
评论
©2010-2024 zouyesheng.com All rights reserved. Powered by GitHub , txt2tags , MathJax