linux下安装python3.7.2

1.到python的官网去下载python3.7.2安装包,必须是Linux版本的

2.在/usr/tmp下下载python安装包

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

3.解压python到/usr/local/etc目录下

tar -zxvf Python-3.6.6.tgz -C /usr/local/etc

4.安装必要组件

#安装gcc在./configure时会error,configure: error: no acceptable C compiler found in $PATH
yum install gc
 #安装openssl-devel,否则会忽略pip安装失败,pip command not found ,但是没有error
yum install openssl-devel
#3.7版本需要一个新的包libffi-devel
yum install libffi-devel -y

5.安装

cd Python-3.*.*
./configure --prefix=/usr/local/python3
make && make install

6.软连接,相当于快捷方式

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

执行后,就可以在命令中使用了

 


 

https://www.cnblogs.com/zhangqigao/p/11661875.html

https://blog.csdn.net/qq_36416904/article/details/79316972

posted @ 2021-01-19 21:02  冬音  阅读(385)  评论(0编辑  收藏  举报