How to import modules from specific Python installation?

K

kk

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
 
D

Dave Angel

kk said:
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.
 
D

David Lyon

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

You can probably achieve this by adjusting the pythonpath to
search through the site-packages directory of the other installation.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top