linux 安装python3.x
1、自己装好linux,配置好linux
我的系统用的是centos7
2、
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 gcc*
3、下载python tar包
https://www.python.org/ftp/python/
选择自己喜欢的小版本
4、把下载好的python包放进/usr/local文件夹里进行解压
最后进行编译
编译命令:
./configure --prefix=/usr/local/python3
再执行下面命令:
make && make install
5、建立软链接
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3 ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3
6、测试python是否能用
[root@mini Python-3.7.0]# python3 Python 3.7.0 (default, Jul 28 2018, 22:47:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> print("hello world!") hello world! >>> exit()