Centos7安装python3.8.5

阅读数:117 评论数:0

跳转到新版页面

分类

python/Java

正文

一、安装依赖项

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel 

另外需要本机装有gcc和make

二、下载

wget https://cdn.npm.taobao.org/dist/python/3.8.5/Python-3.8.5.tgz

三、解压安装

tar -zxvf Python-3.8.5.tgz
// 如果之前没有安装过python3,可以直接用 /usr/local
mkdir /usr/local/Python3.8.5
.configure --prefix=/usr/local/Python3.8.5 --enable-optimizations --enable-shared
make
make install

1、--enable-shared

表示生成动态链接库。

四、创建链接

ln -s /usr/local/python3.8.5/bin/python3 /usr/bin/python3
ln -s /usr/local/python3.8.5/bin/pip3  /usr/bin/pip3

 

常见问题

1、python安装完成之后动态库libpython3.x.so.1.o找不到

cp /usr/loca/python3.8.5/lib/libthon3.8.5.so.1.0 /usr/lib64
ldd /usr/local/python3.8.5/bin/python3



相关推荐