CentOS7.3安装Python3.6

系统:CentOS Linux release 7.3.1611 (Core)  (不是mini)

 

1.安装依赖

2.下载

3.进入源代码包并编译安装

参数,–prefix 是安装目录,–enable-optimizations 是启用优化选项(LTO,PGO 等),会增加编译时间
Warning:make install can overwrite or masquerade the python3 binary. make altinstall is therefore recommended instead of make install since it only installs exec_prefix/bin/pythonversion.

4.查看版本

Python 3.6.2rc1

5.环境配置

[root@CentOS7 ~]# python3
Python 3.6.2rc1 (default, Jul 6 2017, 12:02:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>>

 

系统里还有2.7.5版本,可创建虚拟环境

(以下步骤可忽略,参考文档:https://docs.python.org/3/library/venv.html)

激活虚拟环境

查看版本

Python 3.6.2rc1

——-操作过程——

 

 

原创文章,转载请注明: 转载自老周博客

本文链接地址: CentOS7.3安装Python3.6

Share This!

Leave a Reply

Your email address will not be published. Required fields are marked *