不死孤狼
IT 从来都是一个有新技术驱动的行业

安装说明

在centos 7 中,默认使用的是python 2.7 因为几个关键的应用程序依赖于Python 2.7.5。如果替换了系统的Python环境就会发生很多难以预见的错误,甚至要重装系统。 我们使用make altinstall,如果使用make install,你将会看到在系统中有两个不同版本的Python在/usr/bin/目录中。这将会导致很多问题,而且不好处理。

 

一. 下载python3

wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz

 

二. 安装

tar zxvf Python-3.5.1.tgz 

cd Python-3.5.1/

./configure --prefix=/data/python3 

 make

make altinstall

三.

python程序的执行文件:/usr/local/bin/python3.5 
python应用程序目录:/usr/local/lib/python3.5 
pip的执行文件:/usr/local/bin/pip3.5

四.查看安装的版本

cd /data/python3/bin/

[linuxidc@localhost bin]$ python3.5 -V

Python 3.5.0

 

五.添加环境变量

vim /etc/profile

 

export PYTHON_HOME=/data/python3
export PATH=$PATH:$PYTHON_HOME/bin

source /etc/profile

六.使用:

#python3.5

Python 3.5.1 (default, Mar 9 2018, 17:55:48)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

安装成功了!

如果提示:Ignoring ensurepip failure: pip 7.1.2 requires SSL/TLS

这是原因没有安装或升级oenssl:

yum install openssl-devel

  

 

posted on 2018-03-09 18:08  不死孤狼  阅读(94)  评论(0)    收藏  举报