python linux 安装
2015-09-30 17:06
459 查看
参考文件地址
http://ericslau.iteye.com/blog/1845654
下载安装包
可利用linux自带下载工具wget下载,如下所示:
1 # wget http://www.python.org/ftp/python/3.3.0/Python-3.3.0.tgz 2 tar -xzvf Python-3.3.0.tgz)
进入压缩目录后在执行以下命令
1 cd Python-3.3.0
在编译前先在/usr/local建一个文件夹python3(作为python的安装路径,以免覆盖老的版本)
1 mkdir /usr/local/python3 ,一定要进入解压后得目录,里面才会有configure 该文件
开始编译安装
1 ./configure --prefix=/usr/local/python3 执行该命令后创建makefile文件
2 make
3 make install
注意
在执行./configure --prefix=/usr/local/python3 ,时出现 checking build system type... x86_64-unknown-linux-gnuchecking host system type... x86_64-unknown-linux-gnuchecking for --enable-universalsdk... nochecking for --with-universal-archs... 32-bitchecking MACHDEP... linuxchecking for --without-gcc... nochecking for gcc... nochecking for cc... nochecking for cl.exe... noconfigure: error: in `/usr/local/Python/Python-3.3.0':configure: error: no acceptable C compiler found in $PATHSee `config.log' for more details执行yum -y install gcc 后在安装执行上述命令即可
此时没有覆盖老版本,再将原来/usr/bin/python链接改为别的名字
1 mv /usr/bin/python /usr/bin/python_old
再建立新版本python的链接
1 ln -s /usr/local/python3/bin/python3 /usr/bin/python
这个时候输入
1 python
就会显示出python的新版本信息
1 Python 3.1.2 (r312:79147, Oct 21 2012, 01:03:21))
2 [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
3 Type "help", "copyright", "credits" or "license" for more information.
4 >>>
PS:如果不建立新安装路径python3,而是直接默认安装,则安装后的新python应该会覆盖linux下自带的老版本,也有可能不覆盖,具体看安装过程了,这个大家可以自己试验下,当然如果还想保留原来的版本,那么这种方法最好不过了。
http://ericslau.iteye.com/blog/1845654
下载安装包
可利用linux自带下载工具wget下载,如下所示:
1 # wget http://www.python.org/ftp/python/3.3.0/Python-3.3.0.tgz 2 tar -xzvf Python-3.3.0.tgz)
进入压缩目录后在执行以下命令
1 cd Python-3.3.0
在编译前先在/usr/local建一个文件夹python3(作为python的安装路径,以免覆盖老的版本)
1 mkdir /usr/local/python3 ,一定要进入解压后得目录,里面才会有configure 该文件
开始编译安装
1 ./configure --prefix=/usr/local/python3 执行该命令后创建makefile文件
2 make
3 make install
注意
在执行./configure --prefix=/usr/local/python3 ,时出现 checking build system type... x86_64-unknown-linux-gnuchecking host system type... x86_64-unknown-linux-gnuchecking for --enable-universalsdk... nochecking for --with-universal-archs... 32-bitchecking MACHDEP... linuxchecking for --without-gcc... nochecking for gcc... nochecking for cc... nochecking for cl.exe... noconfigure: error: in `/usr/local/Python/Python-3.3.0':configure: error: no acceptable C compiler found in $PATHSee `config.log' for more details执行yum -y install gcc 后在安装执行上述命令即可
此时没有覆盖老版本,再将原来/usr/bin/python链接改为别的名字
1 mv /usr/bin/python /usr/bin/python_old
再建立新版本python的链接
1 ln -s /usr/local/python3/bin/python3 /usr/bin/python
这个时候输入
1 python
就会显示出python的新版本信息
1 Python 3.1.2 (r312:79147, Oct 21 2012, 01:03:21))
2 [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
3 Type "help", "copyright", "credits" or "license" for more information.
4 >>>
PS:如果不建立新安装路径python3,而是直接默认安装,则安装后的新python应该会覆盖linux下自带的老版本,也有可能不覆盖,具体看安装过程了,这个大家可以自己试验下,当然如果还想保留原来的版本,那么这种方法最好不过了。
相关文章推荐
- Centos6 编译安装Python
- 硬盘安装CentOS 6.2以及添加GRUB启动菜单
- CentOS 6.2实战部署Nginx+MySQL+PHP
- CentOS 7系统配置上的变化解析
- CentOS下DB2数据库安装过程详解
- CentOS 6.3下编译安装Ruby 2.0笔记
- 在Centos 5.5 上编译安装mysql 5.5.9
- CentOS 6.5源码安装Erlang教程
- centos 5.6 升级php到5.3的方法
- CentOS mysql安装系统方法
- centos下安装mysql服务器的方法
- CentOS 5.1 4.6最新官方下载地址列表
- Centos搭建GTK+Codeblock完整版
- CentOS 5.1下跑Mono和Asp.net的实现方法
- centos 安装免费控制面板kloxo步骤
- CentOS服务器+监控宝SNMP监控全攻略分享
- Centos 5下配置https服务器的方法
- centos 5.1下的安全设置(适合所有的linux版本)