Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > 2 versions of python on 1 machine

Reply
Thread Tools

2 versions of python on 1 machine

 
 
flupke
Guest
Posts: n/a
 
      01-06-2005
I searched with Google and on this newsgroups and i didn't find any info
regarding this. If there is more info, please redirect me to that info.

I have version 2.3.4 and 2.4 installed on windows and i thought that by
switching the PYTHONPATH parameter to the dir of the 2.4 version that
that would make python 2.4 active.

However when i envoke python from the commandline, it still runs 2.3.4
Is it possible to have 2 versions installed and switching versions when
you need to?

How can i do that?

Thanks,
Benedict
 
Reply With Quote
 
 
 
 
Peter Hansen
Guest
Posts: n/a
 
      01-06-2005
flupke wrote:
> I have version 2.3.4 and 2.4 installed on windows and i thought that by
> switching the PYTHONPATH parameter to the dir of the 2.4 version that
> that would make python 2.4 active.


That is not the purpose of PYTHONPATH. I'd suggest removing
any definition of this environment variable that you have,
unless you have a specific reason to use it and know what it
actually does. I believe the docs on it are fairly clear,
so reading them again might help. Note that if you have installed
both versions of Python using the regular installer, the
PYTHONPATH information would be redundant anyway because
each version puts the necessary info in the Windows registry.

> However when i envoke python from the commandline, it still runs 2.3.4
> Is it possible to have 2 versions installed and switching versions when
> you need to?


It's quite possible. It sounds like your problem is that you have
the c:\python23 folder in your PATH (note, not PYTHONPATH, just the
old DOS PATH variable). If that's the case, you should probably
remove it and use batch files to invoke the different versions
instead.

> How can i do that?


On my machine, I have a folder called c:\bin where I put useful
batch files. I have a python23.bat and a python24.bat file,
which basically just call c:\python23\python.exe or
c:\python24\python.exe as required. For various reasons which
may or may not apply to you as well, I also have each of them
set the PYTHONHOME variable to point to the right folder
as well.

The content of each batch file is like this:
@echo off
c:\python23\python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9

-Peter
 
Reply With Quote
 
 
 
 
Aaron Bingham
Guest
Posts: n/a
 
      01-06-2005
flupke wrote:
> I have version 2.3.4 and 2.4 installed on windows and i thought that by
> switching the PYTHONPATH parameter to the dir of the 2.4 version that
> that would make python 2.4 active.
>
> However when i envoke python from the commandline, it still runs 2.3.4
> Is it possible to have 2 versions installed and switching versions when
> you need to?
>
> How can i do that?


You need to put the path to the desired version in the PATH environment
variable. You shoudn't need to change PYTHONPATH at all.

--
--------------------------------------------------------------------
Aaron Bingham
Application Developer
Cenix BioScience GmbH
--------------------------------------------------------------------

 
Reply With Quote
 
flupke
Guest
Posts: n/a
 
      01-07-2005
Peter Hansen wrote:
<snip>
>
> On my machine, I have a folder called c:\bin where I put useful
> batch files. I have a python23.bat and a python24.bat file,
> which basically just call c:\python23\python.exe or
> c:\python24\python.exe as required. For various reasons which
> may or may not apply to you as well, I also have each of them
> set the PYTHONHOME variable to point to the right folder
> as well.
>
> The content of each batch file is like this:
> @echo off
> c:\python23\python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
>
> -Peter


I used the 2 batch files technique and removed c:\python23 from my
path var and all is fine now.
Where did you find more info on PYTHONHOME and PYTHONPATH because
the docs don't seem to contain a whole lot of info.

Thanks
Benedict
 
Reply With Quote
 
Nick Coghlan
Guest
Posts: n/a
 
      01-07-2005
flupke wrote:
> Peter Hansen wrote:
>> The content of each batch file is like this:
>> @echo off
>> c:\python23\python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9


More recent versions of Windows should allow you to use %* for "all the
arguments to the batch file".

> Where did you find more info on PYTHONHOME and PYTHONPATH because
> the docs don't seem to contain a whole lot of info.


I think PYTHONPATH is discussed in the tutorial. PYTHONHOME, I'm not so sure on
(PYTHONPATH and PYTHONSTARTUP are the only two you're likely to care about,
though - and I think the Tutorial covers both of them).

Cheers,
Nick.

--
Nick Coghlan | http://www.velocityreviews.com/forums/(E-Mail Removed) | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
 
Reply With Quote
 
Peter Hansen
Guest
Posts: n/a
 
      01-08-2005
flupke wrote:
> I used the 2 batch files technique and removed c:\python23 from my
> path var and all is fine now.
> Where did you find more info on PYTHONHOME and PYTHONPATH because
> the docs don't seem to contain a whole lot of info.


Typing "python -h" gives a good start. I'm sorry, I don't recall
where else there is useful info on those, though I'm pretty sure
Google could help. (I'm not sure there's much to add to what the
"-h" option tells you, however.)

-Peter
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
More Python versions on an XP machine Gabor Urban Python 3 11-15-2009 12:01 PM
How to Machine A python script execute Machine B python script? johnny Python 5 07-11-2007 01:03 PM
Multiple versions of Python / PythonWin on the same machine? dananrg@yahoo.com Python 2 02-24-2006 11:17 PM
2 versions of python on 1 machine flupke Python 1 01-12-2005 04:01 PM



Advertisments