Hi everybody,

I'm trying to install python 3 from source in my new Mandriva 2010. I have read a lot of posts in this website, but none of the instructions has worked for me.

The code compiles and all, but it doesn't install tkinter. I know that tcl/tk are installed because python 2.6 (which comes with Mandriva) can import Tkinter.

I am trying to run this code, and it does work with python 2.x:

from Tkinter import *


root = Tk()
root.geometry("100x100+300+200")
l1 = Label(root, text="Hello World!")
b1 = Button(root, text="close", command=quit)

l1.pack()
b1.pack()

root.mainloop()

I installed the following packages using the package manager:

libtk-devel
libtcl-devel
libtk8.6
libtcl8.6

Still the configure script will not find tcl/tk in my system.

Any help would be appreciated.

Thanks

PS. I know I have to change Tkinter to tkinter, the problem is that python3.1 will not even import tkinter. Instead it gives me the "no module named tkinter" error.

Why are you trying to install python3 from source ? I'm running Mandriva 2010 on a 64 bits processor and I installed the packages python3 and tkinter3 with the software manager. This gave me a working python 3 with tkinter.

Python 3.1.1 (r311:74480, Jan  5 2010, 18:03:14) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> tkinter.Tk()
<tkinter.Tk object at 0x250cad0>

I also ran your code and it works very well (I had to replace Tkinter by tkinter and command=quit by command=root.quit, otherwise it prints None for some reason).

Oh, hi and thanks for replying.

Because installing from source allows me to be more up-to-date. RPM's are not updated that often, and that python version will eventually become outdated.


Besides I wanna learn what the problem with Mandriva is, I have done this several times with several distributions, and it's easy, just install the devel packages and that's it, but Mandriva always gives me trouble...

Note that my python3 package was automatically updated January the 5th. I don't quite understand your argument. Unless you are using bleeding edge features of python, you don't usually need the latest revision of python to run your programs.

That's weird, I updated everything in sight and my python is still 2.64. I do see, however, a python3 package, which is not installed.

That's weird, I updated everything in sight and my python is still 2.64. I do see, however, a python3 package, which is not installed.

Even if you install the python3 package, your system's python remains python2.6. To use python 3, you must invoke /usr/bin/python3 instead of /usr/bin/python.

Well, that's a possibility then. I'll try it in my virtual mandriva.


However, I still wanna find out how to do it from source in Mandriva AND what the problem here is. As I said before, it is not a problem in other distributions, but in Mandriva this is always the case. Last time (Mandriva 2009.1) I had to copy some folders from another system into the /usr/lib directory (if i remember correctly) to get it to work, but I don't have those files anymore.


Any ideas?
Maybe you can tell me what's installed in your system?

Well, that's a possibility then. I'll try it in my virtual mandriva.


However, I still wanna find out how to do it from source in Mandriva AND what the problem here is. As I said before, it is not a problem in other distributions, but in Mandriva this is always the case. Last time (Mandriva 2009.1) I had to copy some folders from another system into the /usr/lib directory (if i remember correctly) to get it to work, but I don't have those files anymore.


Any ideas?
Maybe you can tell me what's installed in your system?

I tried to install python 3 and tkinter 3 from source when Mandriva 2010 was just a few days old and the tkinter3 package was not yet available -- and it failed --, so I'm afraid I can't help you much in this. If you manage doing it (but I still think it is a waste of time), you should post your solution in the mandriva forum, because other users may be interested :)

OK, I'll keep trying then.

Thanks for your help.

I managed to do it. I installed tcl/tk 8.5 from source and in the default directories (/usr/local/lib), then I moved all these files to /usr/lib so that they ended up sitting next to their tcl/tk8.6 counterparts.

I then compiled python 3 normally with the make altinstall option to avoid overwriting the older python, and that did it.

I supposse that this is due to the mandriva devel packages, I suspect they somehow do not install everything that python needs to successfully build the tkinter modules, an this is why you go crazy trying to compile it and getting errors despite the fact that the required packages are there.

Hope this helps someone.

commented: Nice info for Mandrivers like me ! +3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.