发布时间:2019-09-27 07:09:28编辑:auto阅读(2764)
mkdir -p /soft 
cd /soft 
wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
yum install sqlite-develtar xf Python-3.6.6.tgz
cd Python-3.6.6
mkdir -p /usr/local/python3
./configure --prefix=/usr/local/python3
make && make install配置环境变量
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/python3/bin
source ~/.bash_profilepython在使用时,可能会使用ssl模块。所以在编译时,可以直接将ssl模块编译进去。
yum install openssl
yum install openssl-devel -y
cd Python-3.6.6
vi Modules/Setup #修改文件如下
    # Socket module helper for socket(2)
    _socket socketmodule.c
    # Socket module helper for SSL support; you must comment out the other
    # socket line above, and possibly edit the SSL variable:
    SSL=/usr/local/ssl
    _ssl _ssl.c \
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
        -L$(SSL)/lib -lssl -lcrypto
然后进行编译安装即可
上一篇: 利用python3发微信
下一篇: Python3中列表的使用
 51193
 50606
 41232
 38049
 32512
 29419
 28279
 23134
 23093
 21430
 1485°
 2201°
 1823°
 1751°
 2063°
 1812°
 2497°
 4192°
 4051°
 2892°