安装环境:CentOS_8.0_64位
登录用户:root
python版本:3.7.0
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar -zxvf Python-3.7.0.tgz
cd Python-3.7.0
./configure
make
make install
1 | [root@vultr Python-3.7.0]# ./configure |
出现上面的错误是因为没有安装GCC模块,执行如下命令安装:
yum install gcc
1 | [root@vultr Python-3.7.0]# make |
发现没有安装make指令,执行如下命令安装:
yum install make
1 | …… |
发现没有zlib模块,执行如下命令安装:
yum -y install zlib*
1 | …… |
出现上面错误是缺少 libffi-devel,执行如下命令安装:
yum -y install libffi-devel
配置环境变量
cd /usr/local/bin/
可以看到python3.7和pip3.7都安装好了
下一步创建/bin
目录下的软链接
ln -s /usr/local/bin/python3.7 /usr/bin/python
ln -s /usr/local/bin/pip3.7 /usr/bin/pip
1 | [root@vultr opt]# python -V |
至此,python就安装成功了。
后面在使用的时候又出现了报错,需要安装openssl模块。
1 | Could not fetch URL https://pypi.org/simple/shadowsocks/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/shadowsocks/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping |
yum -y install openssl-devel
./configure –with-openssl=/usr/bin/openssl