Neurohazard
暮雲煙月,皓首窮經;森羅萬象,如是我聞。

CentOS 6.7 离线升级至 Python 2.7

wpadmin~July 4, 2018 /System Management

CentOS 6.7 离线升级至 Python 2.7

Contents

CentOS 6.7 离线升级至 Python 2.7

专网环境下,服务器无法连接外网,需要升级 Python 2.6 至 Python 2.7。

Python 编译安装

curl https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz --output python-2.7.15.tgz
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel

进入 Python 所在的目录

./configure
sudo make -j4
sudo make install

pip 离线安装

# setuptools
unzip setuptools-34.2.0.zip
cd setuptools-34.2.0
python setup.py install

# pip
tar xf pip-9.0.1.tar.gz
cd pip-9.0.1
python setup.py install

其他依赖

pip2.7 install  -i http://192.168.1.1/pypi/web/simple <target>
pip2.7 install  -i http://192.168.1.1/pypi/web/simple MySQL-python

参考资料

https://zhuanlan.zhihu.com/p/26596585

Leave a Reply

Your email address will not be published. Required fields are marked *