商务合作加Q:411239339

在CentOS 6中安装python3.8.10

浏览:460次阅读
没有评论

共计 1245 个字符,预计需要花费 4 分钟才能阅读完成。

To install Python 3.8 on CentOS, you need to install OpenSSL as the one installed by CentOS from yum is very old.

cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
tar xvf openssl-1.1.1g.tar.gz
cd openssl-1.1.1g
./config --prefix=/usr/serverok/openssl --openssldir=/usr/serverok/openssl no-ssl2
make
make install

cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
tar xvf openssl-1.1.1g.tar.gz
cd openssl-1.1.1g
./config --prefix=/usr/serverok/openssl --openssldir=/usr/serverok/openssl no-ssl2
make
make install

Now edit file

vi ~/.bash_profile

at end of the file, add

export PATH=/usr/serverok/openssl/bin:$PATH
export LD_LIBRARY_PATH=/usr/serverok/openssl/lib
export LC_ALL="en_US.UTF-8"
export LDFLAGS="-L/usr/serverok/openssl/lib -Wl,-rpath,/usr/serverok/openssl/lib"

Make the settings active with command

source ~/.bash_profile

Now we can install Python 3.8 with

cd /usr/local/src
wget https://www.python.org/ftp/python/3.8.4/Python-3.8.4.tar.xz
tar xvf Python-3.8.4.tar.xz
cd /usr/local/src/Python-3.8.4
make clean && make distclean
./configure --enable-optimizations  --with-openssl=/usr/serverok/openssl/
make altinstall

Now python 3.8 will be available in your system under /usr/local/bin

root@server12:~# python3.8 --version
Python 3.8.4
root@server12:~# which python3.8
/usr/local/bin/python3.8
root@server12:~# 
正文完
扫码赞助
post-qrcode
 0
果子
版权声明:本站原创文章,由 果子 于2023-06-21发表,共计1245字。
转载说明:除特殊说明外本站文章皆由果较瘦原创发布,转载请注明出处。