如何在linux系统中安装python?

如题所述

Linux系统默认是安装有python,可以先在终端输入: python 然后看看是否有回显,如果有就不需要安装了。如果没有,可以按照下面得方法安装:
打开终端,输入:wget
下载完毕后 输入解压命令:tar –zxvf Python-3.5.0b4.tgz
切换到解压的目录:cd Python*
接下来就是安装:
./configure
make
make install
然后查看一下就知道了:
输入python如果出现下面的提示:
Python 3.5.0 (#1, Aug 06 2015, 14:04:52)
[GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
就说明成功了,因为linux系统可能不一样,第二行有可能不同哈。
温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2017-10-11
1.下载源代码

  2. 安装

  $ tar –jxvf Python-2.5.2.tar.bz2

  $ cd Python-2.5.2

  $ ./configure

  $ make

  $ make install

  3. 测试

  在命令行下输入python,出现python解释器即表示已经正确安装。

  在suse10或rhel5(es5)下系统默认已经装了python但版本是2.4.x;本次安装后在shell中输入

  #python

  会发现显示结果:

  # python

  Python 2.4.3 (#1, Dec 11 2006, 11:38:52)

  [GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2

  Type “help”, “copyright”, “credits” or “license” for more information.

  >>>

  版本还是2.4.x的

  解决办法:

  #cd /usr/bin

  #ll |grep python //查看该目录下python

  #rm -rf python

  #ln -s PREFIX/Python-2.5.2/python ./python //PREFIX为你解压python的目录

  #python

  # python

  Python 2.5.2 (#1, Dec 11 2006, 11:38:52)

  [GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2

  Type “help”, “copyright”, “credits” or “license” for more information.

  >>>

  OK!问题解决!本回答被提问者采纳
第2个回答  2018-03-30

linux系统中安装python包括以下三个步骤:

1、下载源代码

2、安装

$ tar –jxvf Python-2.5.2.tar.bz2

$ cd Python-2.5.2

$ ./configure

$ make

$ make install

3、测试

在命令行下输入python,出现python解释器即表示已经正确安装。

在suse10或rhel5(es5)下系统默认已经装了python但版本是2.4.x;本次安装后在shell中输入

#python

会发现显示结果:

# python

Python 2.4.3 (#1, Dec 11 2006, 11:38:52)

[GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2

Type “help”, “copyright”, “credits” or “license” for more information.

>>>

版本还是2.4.x的

解决办法:

#cd /usr/bin

#ll |grep python   //查看该目录下python

#rm -rf python

#ln -s PREFIX/Python-2.5.2/python ./python  //PREFIX为你解压python的目录

#python

# python

Python 2.5.2 (#1, Dec 11 2006, 11:38:52)

[GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2

Type “help”, “copyright”, “credits” or “license” for more information.

>>>

安装测试完毕。

本回答被网友采纳
第3个回答  2012-02-15
ubuntu/debian: apt-get install python
dpkg -i pythonXXX.deb
fedora: yum install python
redhat: rpm -ivh pythonXXX.rpm
gentoo: emerge python
arch: pcaman -S python
suse: yast -i python
...

源代码安装:
wget
tar jxvf Python-2.7.2.tar.bz2
cd Python-2.7.2
./configure --prefix=/usr
make
make install
第4个回答  2017-01-14
已经存在python2的linux环境上安装python3,有两种方法,第一种是替换python2,第二种是直接安装python3,而不替换python2,这样的话,在python3运行的时候,就要写成python3+启动等语句

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网