标签:完成后 bin 通过 开发 yum http install ack style
安装Python3
项目是在py3环境下进行编码的,正好yczhang默认的py版本是2,我们还需要安装py3才能让程序run起来,在此之前,需要安装开发工具包,因为要编译安装Python
[root@yczhang ~]# yum -y group install "Development Tools"
安装Python的依赖包,不安装依赖可能安装完成后没有pip3 软件。
[root@yczhang ~]# yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel vim
下载目前最新的Python3.6.x
1 [root@yczhang ~]# wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
可能你需要通过yum -y install wget
解压编译安装
[root@yczhang ~]# tar xf Python-3.6.0.tgz
[root@yczhang ~]# cd Python-3.6.0
[root@yczhang Python-3.6.0]# ./configure --prefix=/usr/local/python3.6
[root@yczhang Python-3.6.0]# make
[root@yczhang Python-3.6.0]# make altinstall
为pip3和python3创建链接
[root@yczhang Python-3.6.0]# ln -fs /usr/local/python3.6/bin/python3 /usr/local/bin/
[root@yczhang Python-3.6.0]# ln -fs /usr/local/python3.6/bin/pip3 /usr/local/bin/
[root@yczhang Python-3.6.0]# mv /usr/bin/python /usr/bin/python_old
[root@yczhang Python-3.6.0]# ln -fs /usr/local/python3.6/bin/python3.6 /usr/bin/python
[root@yczhang Python-3.6.0]# ln -fs /usr/local/python3.6/bin/pip3.6 /usr/bin/pip
验证安装
[root@yczhang Python-3.6.0]# pip -V
pip 9.0.1 from /usr/local/python3.5/lib/python3.5/site-packages (python 3.6)
[root@yczhang Python-3.6.0]# python -V
Python 3.6.0
修改yum文件,否则yum将无法下载
vim /usr/bin/yum
将
#!/usr/bin/python
修改为
#!/usr/bin/python2.7
保存即可生效
标签:完成后 bin 通过 开发 yum http install ack style
原文地址:https://www.cnblogs.com/huandada/p/9415353.html