Centos6.5源码安装python3.6及离线安装.w

python×××链接:https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz

创新互联是一家专注于成都网站建设、成都网站制作与策划设计,中阳网站建设哪家好?创新互联做网站,专注于网站建设十多年,网设计领域的专业建站公司;建站业务涵盖:中阳等地区。中阳做网站价格咨询:18980820575

上传至服务器:/usr/local/src
tar zxf Python-3.6.3.tgz -C /usr/local/src/
安装依赖:
yum groupinstall "Development tools"
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

源码安装python包
./configure --prefix=/usr/local/python36/ --enable-optimizations
make && make install

编译时长与硬件性能有关
报错解决:
在执行make install
ModuleNotFoundError: No module named '_ctypes'

解决依赖:
依赖下载:
wget http://mirror.yandex.ru/fedora/russianfedora/russianfedora/fixes/el/releases/6/Everything/x86_64/os//xulrunner10-10.0.1-2.el6.R.x86_64.rpm
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/nss-softokn-freebl-3.14.3-23.3.el6_8.x86_64.rpm
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/glibc-2.12-1.212.el6.i686.rpm
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/libffi-3.0.5-3.2.el6.i686.rpm
wget http://mirror.centos.org/centos/6/os/i386/Packages/libffi-devel-3.0.5-3.2.el6.i686.rpm
yum install libffi-devel -y

修改yum包
vim /usr/bin/yum

#!/usr/bin/python 改为 #!/usr/bin/python2.6

修改: /usr/libexec/urlgrabber-ext-down
#! /usr/bin/python2

设置默认python为python3.6
ln -s /usr/local/python36/bin/python3 /usr/bin/python
检查版本
#python -V
Python 3.6.3

pypi官方包下载目录
https://pypi.org/
Centos6.5 源码安装python3.6及离线安装.w
下载什么直接搜索就好了,直接下载即可
安装使用pip install package-name.whl
安装过程中出现各种依赖,对于离线安装的用户可根据提示在pypi官网请添加链接描述进行查找相关依赖的包安装即可。
安装ipthon
下载ipython项目包
https://codeload.github.com/ipython/ipython/zip/master
unzip ipython-master.zip && cd ipython-master
对于源码安装直接运行
python setup.py install
测试
Centos6.5 源码安装python3.6及离线安装.w


标题名称:Centos6.5源码安装python3.6及离线安装.w
浏览路径:http://myzitong.com/article/ggcgeh.html