Debian 7 安装 Python3.4
2014-08-11 22:09
453 查看
Debian 7 自带的python是2.7.3,要用最新的3.4版本怎么办?我们从官网下载压缩包自己编译。
一、安装编译用的包
二、下载压缩包
一、安装编译用的包
$ sudo apt-get install build-essential $ sudo apt-get install libncurses5-dev libncursesw5-dev libreadline6-dev $ sudo apt-get install libdb5.1-dev libgdbm-dev libsqlite3-dev libssl-dev $ sudo apt-get install libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev
二、下载压缩包
wget -c https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz[/code]
三、编译安装$ cd download/ $ tar -zxf Python-3.4.1.tgz $ cd Python-3.4.1 $ ./configure --prefix=/opt/python-3.4.1 $ make $ sudo make install $ cd download/ $ sudo rm -rf Python-3.4.1 #删除解压目录
安装好后把 python3 添加到PATH里,打开~/.bashrc 文件,在最后添加:export PATH=$PATH:/opt/python-3.4.1/bin
保存后:source .bashrc
在终端里输入 python3,可以看到现在的版本是3.4.1。$ python3 Python 3.4.1 (default, Aug 11 2014, 01:23:53) [GCC 4.6.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
2015.01.09 更新:
在make时出现这个提示:# Substitution happens here, as the completely-expanded BINDIR # is not available in configure sed -e "s,@EXENAME@,/opt/python-3.4.2/bin/python3.4m," < ./Misc/python-config.in >python-config.py # Replace makefile compat. variable references with shell script compat. ones; -> sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh >python-config # On Darwin, always use the python version of the script, the shell # version doesn't use the compiler customizations that are provided # in python (_osx_support.py). if test `uname -s` = Darwin; then \ cp python-config.py python-config; \ fi
按提示操作:$ sed -e "s,@EXENAME@,/opt/python-3.4.2/bin/python3.4m," < ./Misc/python-config.in >python-config.py $ sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh >python-config
再make:$ make
最后:sudo make install
在编译安装python3.4.2时有这个提示:INFO: Can't locate Tcl/Tk libs and/or headers Python build finished successfully! The necessary bits to build these optional modules were not found: _tkinter To find the necessary bits, look in setup.py in detect_modules() for the module's name.
解决办法:sudo apt-get install python-tk tcl tk tcl-dev tk-dev
--End--
相关文章推荐
- debian安装Python 和 简单的hello输出示例
- debian下python的基本安装
- 编译安装Python3.4, pip安装, pypi是pip的源,修改为国内的pypi源
- OS X(10.10) python3.4 matplotlib的安装
- 在centos6上面安装python3.4
- Debian 下Django (Apache2/mod_python) 安装指南
- 同一台机器同时安装 python2.7 和 python3.4 会不会冲突
- python3.4 安装pydelicious 错误解决
- 64位win7中使用vs2013为python3.4安装pycrypto-2.6.1插件报Unable to find vcvarsall.bat异常解决方案
- windows安装python3.4-ssh访问模块(paramiko)
- debian6下安装python组件
- 在树莓派(Debian系统)上安装python软件包pymssql
- Ubuntu12.04安装Python3.4和virtualenv
- Python3.4 安装第三方模块Request、BeautifulSoup
- centos上安装Python3.4——源码安装
- Python3.3.0+apache2.4.4+django1.5.4+mod_wsgi3.4安装
- centos6 下安装 Python 3.4
- python3.4安装suds
- Ubuntu 14.10 (64bit) +Qt5.4+Python3.4 +PyQt5.4.1+Eric6安装简介
- 编译安装python2.7及相关模块(debian5.0.1)