Centos安装Python
1 | yum update -y |
1、下载python版本
https://www.python.org/downloads/source/
2、 解压
tar -zxvf Python-3.6.5.tgz
3、进入python目录
cd Python-3.6.5
4、配置
1 | ./configure --prefix=/usr/local/python36 |
1 | make && make install |
5、建立软连接
1 | ln -s /usr/local/python36/bin/python3.6 /usr/bin/python3 |
问题一:
can’t decompress data; zlib not available
解决方案:
1、安装相关的依赖
1 | yum -y install zlib zlib-devel |
2、重新编译python
1 | make install |
问题二:
1 | pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. |
1 | #> python3 |
解决方案:
1、查看openssl安装包
1 | [root@localhost ~]# rpm -aq|grep openssl |
2、如果缺少openssl包安装
1 | [root@localhost ~]# yum install openssl-devel -y |
3、重新编译
1 | ./configure --with-ssl |
4、进入python3检查import ssl
是否正常
This blog is under a CC BY-NC-SA 3.0 Unported License
本文链接:https://blog.suixin.kim/2018/05/01/python-centos-install/