CentOs安装Python3
2016-01-17 23:12
706 查看
1.首先,从sohu的镜像服务器上下载Python3.5的最新的源文件:
wget http://mirrors.sohu.com/python/3.5.1/Python-3.5.1.tgz[/code]
2.解压tar -xzvf Python-3.5.1.tgz
3.接下来就可以编译安装了,我想安装在自己指定的目录下,避免跟系统自带的Python2.6冲突。
进入解压后的Python-3.5.1目录,首先查看README文件,前面的介绍:Build Instructions ------------------ On Unix, Linux, BSD, OSX, and Cygwin: ./configure make make test sudo make install This will install Python as python3. You can pass many options to the configure script; run "./configure --help" to find out more. On OSX and Cygwin, the executable is called python.exe; elsewhere it's just python.
根据提示,执行./configure --help查看帮助:Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [/usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, `make install' will install all the files in `/usr/local/bin', `/usr/local/lib' etc. You can specify an installation prefix other than `/usr/local' using `--prefix', for instance `--prefix=$HOME'.
根据提示,在./configure后面加上--prefix=$HOME应该就可以了。
4.完整的命令如下./configure --prefix=/home/python3 make make install
5.安装完检查一下python3目录:[python3]$ ls bin include lib share
6.把python3/bin目录加到用户的PATH变量中。
7.测试一下:[bin]$ python3 Python 3.5.1 (default, Jan 17 2016, 22:57:35) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> quit()
相关文章推荐
- linux基本工具使用(二)
- zimbra Uninstall Directions for Linux/All Other Operating Systems
- zimbra Uninstall Directions for Linux/All Other Operating Systems
- Linux shutdown命令
- Linux系统故障排除
- Linux标准基础优化
- centos6.7 useradd小结
- 基于tiny4412的Linux内核移植(支持device tree)(一)
- Linux学习笔记:MySQL的授权
- 【Linux】和【Mac】下修改终端提示文字和主机名的方法
- linux编程之内存映射
- Linux内核同步机制之completion
- linux中关于DNS的配置
- linux 常用命令
- linux vi编辑器
- linux trap命令举例
- 【转】centos7安装
- linux搭建ntp服务
- 嵌入式Linux研发,非常值得研究的几个开源项目
- Linux(Ubuntu)环境下使用Fiddler