In order to build python3.4.2 from source with the _tkinter
module you need to install the following build dependency:
sudo apt-get install tk8.6-dev
Then all you have to do is running make
again to add _tkinter
support as the setup.py
file will automatically detect the tk/tcl headers and create the module:
~/Downloads/Python-3.4.2$ make
running build
running build_ext
building '_tkinter' extension
gcc -pthread -fPIC -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -DWITH_APPINIT=1 -I/usr/include/tcl8.6 -I/usr/X11/include -I./Include -I. -IInclude -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/home/sylvain/Downloads/Python-3.4.2/Include -I/home/sylvain/Downloads/Python-3.4.2 -c /home/sylvain/Downloads/Python-3.4.2/Modules/_tkinter.c -o build/temp.linux-x86_64-3.4/home/sylvain/Downloads/Python-3.4.2/Modules/_tkinter.o
gcc -pthread -fPIC -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -DWITH_APPINIT=1 -I/usr/include/tcl8.6 -I/usr/X11/include -I./Include -I. -IInclude -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/home/sylvain/Downloads/Python-3.4.2/Include -I/home/sylvain/Downloads/Python-3.4.2 -c /home/sylvain/Downloads/Python-3.4.2/Modules/tkappinit.c -o build/temp.linux-x86_64-3.4/home/sylvain/Downloads/Python-3.4.2/Modules/tkappinit.o
gcc -pthread -shared build/temp.linux-x86_64-3.4/home/sylvain/Downloads/Python-3.4.2/Modules/_tkinter.o build/temp.linux-x86_64-3.4/home/sylvain/Downloads/Python-3.4.2/Modules/tkappinit.o -L/usr/X11/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -ltk8.6 -ltcl8.6 -lX11 -o build/lib.linux-x86_64-3.4/_tkinter.cpython-34m.so
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2 _dbm _gdbm
_lzma _sqlite3
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
[...]
Now you can import tkinter in python3.4.2:
~/Downloads/Python-3.4.2$ ./python
Python 3.4.2 (default, Oct 30 2014, 11:34:17)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>>
Original answer:
Unless you really need python3.4.2, I would just use the default python3 version on 14.04 (3.4.0)
Then all you have to do is installaling the following packages:
sudo apt-get install python3-tk tk
And start the python interpreter this way:
/usr/bin/python3
Otherwise you'll always get the version that you installed in /usr/local
(3.4.2).
Importing tk in python3 should work now:
$ python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>>
Best Answer
To search for any libraries that might be needed for tracker I did:
which turned up the following leads:
I'd already done a
sudo apt-get install tracker*
so I wasn't missing any of the core utilities or debug symbols so the next obvious lead was...which installed ever thing I could possibly need:
and fixed the import error: