新版博客SEO优化基本完成,新老博客内容正在整合中,保证每篇文章高质量。 SiteMap RSS Github
Centos下Python2和Python3共存
嘉美伯爵   2018年10月10日 20:25   Python   安装   215  

更新软件包

yum clean all  # 清楚缓存
yum list 
yum -y update

安装依赖

yum install gcc  # 后端语言必须
yum install gcc-c++   
yum -y 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

下载

wget https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tgz
mkdir /usr/local/python3 
tar -zxvf Python-3.4.2.tgz
cd Python-3.4.2
./configure --prefix=/usr/local/python3  --enable-optimizations
make && make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3

测试

python3
Python 3.4.2 (default, Jul 19 2016, 03:47:32) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>