Linux手动装Python

1、下载Python软件包 Python-2.7.3.tgz (百度或谷歌就有)

2、传到服务器上,放任意目录,在root下解压:  tar -xzf Python-2.7.3.tgz

3、解压后进入Python-2.7.3目录,执行  ./configure 进行配置

4、配置完成执行编译:  

1

2

make

make install

5、替换以前的python默认版本(若有)(创建新的软连接)

1

2

3

cd /usr/bin/

rm -rf python

ln -s /usr/local/bin/python2.7 ./python

6、然后就可以打印hello,world了

test111:/usr/bin # python

Python 2.7.3 (default, Aug 28 2018, 19:15:29) 

[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2

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

Traceback (most recent call last):

  File "/etc/pythonstart", line 7, in <module>

    import readline

ImportError: No module named readline

>>> print "hello world"

hello world

猜你喜欢

转载自blog.csdn.net/weixin_41171108/article/details/82145435