Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How to import modules from specific Python installation?

Reply
Thread Tools

How to import modules from specific Python installation?

 
 
kk
Guest
Posts: n/a
 
      04-26-2009
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
 
Reply With Quote
 
 
 
 
Dave Angel
Guest
Posts: n/a
 
      04-26-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.


 
Reply With Quote
 
 
 
 
David Lyon
Guest
Posts: n/a
 
      04-26-2009

On Sun, 26 Apr 2009 13:07:24 -0700 (PDT), kk <(E-Mail Removed)> wrote:
> 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

 
Reply With Quote
 
kk
Guest
Posts: n/a
 
      04-27-2009
Hi


Thank you for the suggestions, I will see what I can from here.
 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
install modules for specific python version Brendan Miller Python 1 02-01-2009 01:37 AM
Newb, using Python in win32 app, how to import c++ modules created with swig from an .exe Jon Moldover Python 0 10-28-2003 11:34 PM
imputils - import problem modules from sys.modules Remy Cool Python 1 08-27-2003 02:25 PM



Advertisments