****大家好,我是霸王卸甲,很长时间没更新博客了,今天给大家带来的是centos python3的源码安装教程!!!!!
python官网:https://www.python.org/
下载python3的包
装好yum源和epel源
解压安装
[[email protected] a]# ls
Python-3.6.0.tgz
[[email protected] a]# tar -xf Python-3.6.0.tgz -C /usr/local/src/
[[email protected] a]# cd /usr/local/src/
[[email protected] src]# ls
Python-3.6.0
[[email protected] src]# cd Python-3.6.0/
[[email protected] Python-3.6.0]# sed -i ‘s/^#readline/readline/‘ Modules/Setup.dist
[[email protected] Python-3.6.0]# sed -ri ‘s/^#(_ssl)/\1/p‘ Modules/Setup.dist
[[email protected] Python-3.6.0]# sed -ri ‘s/^#([\t]-DUSE)/\1/p‘ Modules/Setup.dist
[[email protected] Python-3.6.0]# sed -ri ‘s/^#([\t]-L\$(SSL))/\1/p‘ Modules/Setup.dist
[[email protected] Python-3.6.0]# 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 gcc
[[email protected] Python-3.6.3]# ./configure --enable-shared --enable-optimizations
[[email protected] Python-3.6.3]# make -j 2 && make install
(-j 是cpu个数)
配置共享库文件
- 先找到这个文件的安装路径
- 为所有用户设置共享库目录
用 vi 编辑器打开配置文件
/etc/profile
vi /etc/profile
?
在文件末尾写上如下内容:
python3.6共享目录
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
测试python3
输入 exit()
即可退出 python3.6
以上就是安装python的过程了,大家可以试一试,有问题即使给我留言,谢谢大家!!!!
原文地址:http://blog.51cto.com/13575683/2114585