[Tutor] Multiple versions of python and paths problems

Alan Gauld alan.gauld at btinternet.com
Wed Sep 8 00:34:36 CEST 2010


"Dominique" <mydomdom at gmail.com> wrote

>> How do you start IDLE? Is it via a desktop or start menu shortcut?
>> If so what is the startin folder specified as?

You omitted to answer the bit about the startin folder.
You will see this if you open the shortcut properties.

> The error is when launching the app which needs PIL, numpy... from 
> 2.5 and not
> 2.6 (the versions imported are those of 2.6, causing the app to 
> crash)
>
>> In which order?
>
> PYTHONPATH is as follows:
> D:\Python26\Lib\site-packages;
> D:\Python25\Lib\site-packages;
> D:\Python25\Lib\site-packages\pyvision\releases\pyvision_0.8.1\src\
>
> Which order should I use ?

You need to put 2.5 ahead of 2.6.
Python will look in the folders in the order given and stop
when it finds what its looking for. In your case that means
it looks in 2.6 first.

>> Set the Quick Edit option for the terminal it will save you a lot 
>> of
>> pain.
> Thanks for the tip !  It's a special cut&paste (you have to 
> right-click on the
> bar to have it work)!!

It is unusual but if you set quick edit you don;t need to use the 
title bar.
Select with the mouse.
Hit enter to copy
Use right-click to paste within the DOS box (no menu required)
Or use normal Ctrl-V to pasdte in other windows(like email say)

You can use the title bar menu too for slightly more control.

The help screens will give you lots more shortcuts like command
history recall and search, use of tab for command/file completion etc 
.

>> But if the paths are right it should work, and you may need to 
>> create
>> a startup DOS file to set them before executing python...
> I tried without success...
> How would you do this ?

Just create a .bat file     (python2.5.bat say) with

ECHO OFF
SET PATH  <full path to python 2.5 here>
SET PYTHONPATH  <only the python 2.5 lib folders here>
python %1 %2 %3 %4 %5 %6 %7 %8 %9

Should be adequate.

And do the same for v2.6. Then run the batch files (create shortcuts 
if you like)
as needed.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list