Python--Linux上安装Python

Linux 上安装 Python

官网下载:https://www.python.org/downloads/

本文安装包下载链接:https://pan.baidu.com/s/1uL2JyoY_gClfOtyH0CcjfA 提取码:elan

详细操作步骤

1、安装相关插件

[root@bJ ~]# yum install zlib-devel openssl openssl-devel gcc sqlite-devel

2、安装python

[root@bJ ~]# tar xf Python-3.6.3.tar.xz  -C /usr/src/
[root@bJ ~]# cd /usr/src/Python-3.6.3/
[root@bJ Python-3.6.3]# ./configure --enable-optimizations
[root@bJ Python-3.6.3]# make && make install

3、安装完成后做个软链接方便调用

[root@bJ Python-3.6.3]# ln -s /usr/local/bin/python3.6 /bin/
[root@bJ Python-3.6.3]# ln -s /usr/local/bin/pip3.6 /bin/

4、测试是否安装成功

[root@bJ Python-3.6.3]# python3.6
Python 3.6.3 (default, Nov  1 2018, 12:19:44) 
[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
原文地址:https://www.cnblogs.com/yanjieli/p/9888596.html