Ubuntu下安装Python2.6.1以及Tkinter
来源:互联网 发布:制作淘宝店铺logo 编辑:程序博客网 时间:2024/06/05 12:03
我是先装好Python,后来要用到Tkinter才装的
1.安装Python2.6.1:
dumeifang@dumeifang-desktop:~$ su
Password:
root@dumeifang-desktop:/home/dumeifang#wget http://www.python.org/ftp/python/2.6.1/Python-2.6.1.tgz
--14:28:31-- http://www.python.org/ftp/python/2.6.1/Python-2.6.1.tgz
=> `Python-2.6.1.tgz'
Resolving www.python.org... 82.94.164.162
Connecting to www.python.org|82.94.164.162|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13,046,455 (12M) [application/x-tar]
......
解压:tar xfz Python-2.6.1.tgz
切换目录:cd Python-2.6.1
configure: ./configure
编译:make
安装:make install
试一下能不能用:
root@dumeifang-desktop:/home/dumeifang/Python-2.6.1#exit exit dumeifang@dumeifang-desktop:~$python Python 2.6.1 (r261:67515, Mar 31 2009, 14:49:24) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 2.安装Tkinter
root@dumeifang-desktop:/home/dumeifang#apt-get install python-tk 提示安装 成功 进入Python查看是否能用: dumeifang@dumeifang-desktop:~$ python Python 2.6.1 (r261:67515, Mar 31 2009, 14:49:24) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import Tkinter Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.6/lib-tk/Tkinter.py", line 39, in <module> import _tkinter # If this fails your Python may not be configured for Tk ImportError: No module named _tkinter >>> 不能用
安装tcl/tk8.5.6
(1). 安装tcl8.5.6
cd tcl8.5.6/unix
./configure --enable-gcc –enable-shared
make
sudo make install
(2). 安装tk8.5.6
cd tk8.5.6/unix
./configure –enable-gcc –enable-shared –with-tcl=../../tcl8.5.6/unix
make
make时出现一堆错误:
‘TkWindow’ has no member named ‘dispPtr’
......
类似这些
在新得利软件包中把x11的devel包都选择安上,再回来 make,编译成功
make install 安装成功
修改Python-2.6.1/Modules/Setup.dist文件,将以下部分开启:
# *** Always uncomment this (leave the leading underscore in!):
_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT /
# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
-L/usr/local/lib /
# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
-I/usr/local/include /
# *** Uncomment and edit to reflect where your X11 header files are:
#-I/usr/X11R6/include /
......
# *** Uncomment and edit to reflect your Tcl/Tk versions:
-ltk8.5 -ltcl8.5 /
......
# *** Always uncomment this; X11 libraries to link with:
-lX11
使用make命令进行编译,出现 以下错误:
Failed to find the necessary bits to build these modules:
_bsddb _hashlib _sqlite3
_ssl bsddb185 bz2
dbm gdbm readline
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
从新得利软件包当中查找libssl-dev, libbz2-dev, libgdbm-dev, libreadline5-dev, libsqlite3-dev安装上
重新make,依然还有错误:
Failed to find the necessary bits to build these modules:
_bsddb bsddb185 dbm
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
从网上下了一个补丁http://www.lysium.de/sw/python2.6-disable-old-modules.patch,放到当前目录下运行:
patch -p1 < python2.6-disable-old-modules.patch
再make,还有错误,抑郁:
Failed to find the necessary bits to build these modules:
_bsddb dbm
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
从新得利软件包中找到libdb4.4-dev装上,再make,这次编译终于通过了!
最后make install
检验一下:
dumeifang@dumeifang-desktop:~$ python
Python 2.6.1 (r261:67515, Mar 31 2009, 14:49:24)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>>
成功,终于搞定!不容易呀!
- Ubuntu下安装Python2.6.1以及Tkinter
- Ubuntu下安装Python2.7.5
- ubuntu下安装python的Tkinter库
- ubuntu 安装Tkinter, ImageTk...
- Ubuntu下给Python2安装PIL(Python_Image_Library)
- ubuntu下python2.7版安装sicpy
- linux下python升级以及安装tkinter的一系列问题
- Ubuntu下安装Python的Tkinter和Pmw库
- Ubuntu 安装pyqt ,tkinter,eric
- ubuntu 安装python2.7
- Ubuntu-Python2.7下安装 scipy,numpy,matplotlib,nose
- 【LinCV】Ubuntu 15.04下安装python2.7+openCV3.0
- Ubuntu系统中Python2/Python3下安装openCV
- Ubuntu环境下安装python3.5保留系统python2.7
- python3 centos下安装tkinter
- python2.7 Tkinter 入门
- 安装python2.7以及fabric
- python2以及pip windows 安装
- Samba 学习笔记
- 离别了,我的XXX公司
- JavaScript世界时万年历
- 什么是MVC
- wince books
- Ubuntu下安装Python2.6.1以及Tkinter
- AIX开发环境介绍
- 减少Firefox的内存消耗
- Spring是什么?
- 记测试工具iozone,iometer,bonnie++
- ExtJs 2.1 中的htmlEncode和htmlDecode不可逆
- Recv 返回10054的原因及解决
- IHTMLElement 得到所属的 IHTMLForm
- do/while(0)的妙用