沙漠网

系统IT运维技术站

centos安装python3

安装依赖

yum install xz wget gcc make gdbm-devel openssl-devel sqlite-devel zlib-devel bzip2-devel -y


下载源码:wget -c https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz


备份Python2的环境

mv /usr/bin/python /usr/bin/python_bak


编译安装3:

tar zxvf Python-3.6.2.tgz

cd Python-3.6.2

./configure --prefix=/usr/local/python3 --enable-shared --enable-loadable-sqlite-extensions --with-zlib

make

make install


添加软连接

ln -s /usr/local/python3/bin/python3.6  /usr/bin/python

ln -s /usr/local/python3/bin/pip3  /usr/bin/pip3


添加链接库

vi /etc/ld.so.conf

添加/usr/local/python3/lib/


让链接库生效

/sbin/ldconfig



更改以下文件头 #!/usr/bin/python 改为 #!/usr/bin/python_bak


/usr/bin/yum

/usr/libexec/urlgrabber-ext-down

/usr/bin/yum-config-manager 

/usr/bin/yum-debug-restore 

/usr/bin/yum-groups-manager

/usr/bin/yum-builddep 

/usr/bin/yum-debug-dump 

/usr/bin/yumdownloader

/usr/bin/gnome-tweak-tool

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Powered By Z-BlogPHP 1.7.3

Copyright Daixh.com Rights Reserved. 京ICP备09012299号-1

联系我:home#daixh.com (#改@)