I'm new to programming and thought Python would be a good language to learn. Most of the tutorials I found were 2.7 based so I started to learn using that version. I've recently found a tkinter tutorial that I'd like to try out but I'm having a problem. If I run a script it will use Python 2.7 which contains Tkinter and not tkinter.
This problem made me think, how can I get my two versions to co-exist so I can program in both 2.x and 3.x?
You can have both versions installed at the same time.
You can have them coexist because 3.2 is backwards-compatible.
I'm not sure I understand your question, but I'll take a shot. I'm also assuming you're on Windows.
It's simple -- just install both. They will install to different directories, create different start menu folders, etc. I'd also reccomend PyWin32 for the PythonWin editor installed in both 2.7 and 3.2,
If you mean how do you write one script that works with either Python 2 or Python 3, look at http://docs.python.org/library/2to3.html
wget <python download url>
tar xfvz Python-X.Y.Z.tar.gz
cd Python-X.Y.Z
configure --prefix=/path/to/python-x.y.z
make install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With