How to import modules from specific Python installation?

Dave Angel davea at ieee.org
Sun Apr 26 23:51:01 CEST 2009


kk wrote:
> Hi
>
> I know there is a way to import from different Python installation but
> I could not find the answer.  I have Python 2.6 and 2.5
>
>
> thanks
>
>   
There's always the question of whether it's a good idea.  My opinion is 
that if you want to use python source files from another version, you 
should *copy* them into your present version's syspath, and import them 
as a 3rd party site-package.  So it's a question of putting it in the 
site-packages directory and adding a __init__.py file.

Alternatively, you can modify the sys.path, import it, then restore the 
sys.path.  With that hack, you can do anything.





More information about the Python-list mailing list