linux上安装python3.7

发布时间:2024年01月01日

1.在liunx上安装python运行环境
yum -y install gcc

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 libffi-devel

2.进入到安装目录
cd /usr/local/

3.下载python3.7的安装包 (可能会有点慢)
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz

4.解压安装包
tar -zxvf Python-3.7.0.tgz

5.配置python环境以及安装编译python
1) mkdir /usr/local/python3
2) cd Python-3.7.0
3) ./configure --prefix=/usr/local/python3
4) make && make install

6.确认安装成功
/usr/local/python3/bin/python3.7

会出现:
?? ??? ??? ? Python 3.7.0 (default, Jun ?6 2022, 11:01:13)?
?? ??? ??? ?[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
?? ??? ??? ?Type "help", "copyright", "credits" or "license" for more information.

>>> print("Hello World!")
Hello World!
>>> exit()
表示安装成功~
?

文章来源:https://blog.csdn.net/lpx1249115962/article/details/135328748
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。