一聚教程网:一个值得你收藏的教程网站

热门教程

CentOS系统安装Python3.5的方法

时间:2022-06-30 21:01:22 编辑:袖梨 来源:一聚教程网

方法一,在线安装

# 下载Python源(Download Python source)
$wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz

# 提取Python包(Extract Python package):
$tar xf Python-3.5.1.tar.xz

$xz -d Python-3.5.1.tar.xz

$cd Python-3.5.1

# 编译的Python(Compile Python):
$./configure

# Make:
$make

# 安装(Install):
$make install

# 检查Python版本(Check Python version):
$which python3.5
/usr/local/bin/python3.5


方法二,另一种安装方法

1、在官方网站下载python安装包,这里注意python.org/download路径被屏蔽,需要使用http://www.python.org/页面上的中文“下载”链接进行下载。

这里下载了python最新的3.2.2版本:Python-3.2.2.tgz

下载后,文件目录在/home/python/下,这也是我python的安装目录


2、解压:

[root@www python]# tar zxvf    Python-3.2.2.tgz


3、打开安装目录,执行:

[root@www python]# cd Python-3.2.2

[root@www Python-3.2.2]#./configure

[root@www Python-3.2.2]# make

[root@www Python-3.2.2]# makeinstall

值此,安装完成。


4、但此时输入”python”命令,仍然显示是旧版本的,这就需要创建软连接:

[root@www bin]# cd /usr/bin

[root@www bin]# ll |grep python

[root@www bin]# rm -rf python

[root@www bin]# ln -s /home/python/Python-3.2.2/python python

[root@www bin]# python

Python 3.2.2 (default, Oct 26 2011, 23:40:16)

[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2

Type "help", "copyright", "credits" or"license" for more information.

>>>

热门栏目