0
点赞
收藏
分享

微信扫一扫

部署Python3

JakietYu 2023-04-15 阅读 62

1、安装编译工具

yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum install libffi-devel

2、下载软件包并解压

wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
tar -xvJf  Python-3.7.0.tar.xz

3、编译安装

mkdir /usr/local/python3
cd Python-3.7.0
./configure --prefix=/usr/local/python3
make && make install

4、创建软链接

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

5、验证

python3 -V
pip3 -V

6、指定安装源

pip3 install pexpect -i https://mirrors.aliyun.com/pypi/simple/

# 阿里云
https://mirrors.aliyun.com/pypi/simple/ 
# 清华大学
https://pypi.tuna.tsinghua.edu.cn/simple/
# 中国科技大学
https://pypi.mirrors.ustc.edu.cn/simple/ 
# 豆瓣
http://pypi.douban.com/simple 
# Python官方
https://pypi.python.org/simple/ 
# v2ex
http://pypi.v2ex.com/simple/ 
# 中国科学院
http://pypi.mirrors.opencas.cn/simple/

7、备注

安装saltstack会自动安装python3

举报

相关推荐

0 条评论