手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

CentOS 7.2 源码安装Python 3.6

[日期:2018-01-25] 来源:Linux社区  作者:nidey [字体:大 中 小]

1.环境
安装CentOS 7.2最小系统(CentOS-7-x86_64-Minimal-1511.iso)

2.需求
Python-3.6.4.tar.xz(官网下载)

GCC(yum安装)

一堆开发库(yum安装)

3.编译
3.1安装编译器
yum -y install gcc3.2安装依赖

yum -y install bzip2-devel sqlite-devel openssl-devel readline-devel xz-devel xz-devel tk-devel gdbm-devel3.3编译源码
tar Jxvf Python-3.6.4.tar.xz

cd Python-3.6.4

./configure

(如果需要发布版,则配置时要开优化,编译较慢./configure --enable-optimizations)
make -j4

make install默认安装到/usr/local

注意如果不安装3.2依赖开发库,则编译完成后会提示有些模块没有编译

Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2                  _curses              _curses_panel     
_dbm                  _gdbm                _lzma             
_sqlite3              _ssl                  _tkinter         
readline              zlib                                   
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
atexit                pwd                  time             
running build_scripts

4.运行
[root@py3 Python-3.6.4]# python3
Python 3.6.4 (default, Jan 16 2018, 10:17:58)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

本文永久更新链接地址:http://www.linuxidc.com/Linux/2018-01/150564.htm

linux
相关资讯       Python 3.6  CentOS源码安装Python 
本文评论   查看全部评论 (1)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
第 1 楼
* iTanxin会员 发表于 2018/1/28 11:28:09
好文章,正好需要,多谢