linux安装python3.9.0

1. 遇到的问题,我在用pip安装三方工具的时候出现错误

pip is configured with locations that require TLS/SSL

1 ./configure --prefix=/usr/local/python3 --with-ssl
2 
3 make
4 
5 make install

需要重新编译python

创建软连接

ln -s /usr/local/python3/bin/python3 /usr/bin/python  这样在根目录输入python直接可以进入python环境

ln -s /usr/local/python3/bin/pip3 /usr/local/pip  同上

2.  centos8 安装python3.9

1. 准备编译环境

yum groupinstall 'development tools'

yum install  bzip2-devel expat-devel gdbm-devel ncurses-devel openssl-devel readline-devel sqlite-devel tk-devel xz-devel zlib-devel wget

yum install libffi-devel -y

2. 下载python3.9

wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz

3. 解压下载后的文件

tar zxvf Python-3.9.0.tgz

4. 编译安装

./configure --prefix=/usr/local/python3.9

make && make altinstall

5. 建立软连接

ln -s /usr/local/bin/python3.9 /usr/local/bin/python3

ln -s /usr/local/bin/pip3.9 /usr/local/bin/pip3

Centos8 下升级python3.6到3.9

1. 官网下载python3.9源码文件

wget source_code_url

2. 解压文件

tar -zxvf Python3.9.x.tgz

3. 安装必要的包(根据提示,有就不用安装了)

dnf -y install gcc zlib* libffi-devel

4. 进入解压目录,进行编译和安装(根据需要自定义目录)

cd python3.9_folder
./configure --prefix=/usr/local/bin/python3
make&&make install

5. 删除原先的命令,并建立新的软连接

rm -rf /usr/bin/python3
ln -s /usr/local/bin/python3/bin/python3 /usr/bin/python3

6. 检查并验证

python3  -V

 

posted @ 2020-12-04 15:34  恰恰的故事  阅读(1562)  评论(0编辑  收藏  举报