有勇气的牛排博客

CentOS安装python

有勇气的牛排 1143 Python 2021-10-04 20:18:07

1 下载

下载地址:

https://www.python.org/ftp/python
cd /usr/local mkdir python3

wget

wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz
[root@charles python3]# tree -d -L 1 Python-3.8.5 Python-3.8.5 ├── Doc ├── Grammar ├── Include ├── Lib ├── m4 ├── Mac ├── Misc ├── Modules ├── Objects ├── Parser ├── PC ├── PCbuild ├── Programs ├── Python └── Tools 15 directories

2 安装

删除原装python

pm -qa | grep python | xargs rpm -e --allmatches --nodeps

如果原有软连接

rm -rf /usr/bin/python3 rm -rf /usr/bin/pip3

2.1 将创建的文件夹设置为程序主目录

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

如果没有权限,则授权

chmod -R 777 Python-3.8.5

2.2 编译安装

make && make install

2.3 建立软连接

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

3 查看安装结果

python3 --version

留言

有勇气的牛排 2024-12-18 23:14:47
有疑问可留言
专栏
文章
加入群聊