I have several programs written for Python 2.6. When I downloaded Python 3.0 the programs wouldn't run. I'd like to have both versions on my computer and be able to run my 2.6 programs by default. Then, for new programs, I'd like to switch to 3.0.

How can I do this, or can I do it at all?

Thank you.

Recommended Answers

All 3 Replies

I have a symlink from /usr/bin/python to python2.5 as the default. If I want to use 2.6 or 3.x I simply use the shebang
#!/usr/bin/python3.0
They install into different library directories, so multiple versions isn't problem.

If you use Windows, you can write a batch file to force an IDE like IDLE to use Python30 this way ...

REM a batch file to force IDLE to use Pyhon30
REM saved as IDLE30.bat
C:\Python30\pythonw.exe -u C:\Python30\Lib\idlelib\idle.pyw

Conversely you can do the a similar thing for Python26 ...

REM a batch file to force IDLE to use Pyhon26
REM saved as IDLE26.bat
C:\Python26\pythonw.exe -u C:\Python26\Lib\idlelib\idle.pyw

Then you can make desktop icons for the two batch files.

Also on windows, doing a "repair" in the control panel Add/remove programs on the version you want will set it as the default.

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.