467,907 Members | 1,181 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,907 developers. It's quick & easy.

Path python versions and Macosx

Hi everyone,
I use python on macosx with textmate as editor (great program).

I also use macport to install unix programs from the command line and
I find it great too.
Well I would like to have all my modules in the path when I'm using
textmate AND when I use the commandline (ipython), but because
textmate and the command line use different python versions they also
search in different places..

I found somewhere to write .pythonrc.py like this

#!/usr/bin/env python
import sys
PATH='/opt/local/lib/python2.4/site-packages/'
sys.path.append(PATH)
del sys

But it doesn't work either, I also tried to append this
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/
local/lib/python2.4/site-packages:${PATH}
to .bash_profile but nothing.

Where should I set this variables??

Thanks a lot

May 11 '07 #1
  • viewed: 1547
Share:
4 Replies
On May 11, 1:36 pm, andrea <kerny...@gmail.comwrote:
Hi everyone,
I use python on macosx with textmate as editor (great program).

I also use macport to install unix programs from the command line and
I find it great too.
Well I would like to have all my modules in the path when I'm using
textmate AND when I use the commandline (ipython), but because
textmate and the command line use different python versions they also
search in different places..

I found somewhere to write .pythonrc.py like this

#!/usr/bin/env python
import sys
PATH='/opt/local/lib/python2.4/site-packages/'
sys.path.append(PATH)
del sys

But it doesn't work either, I also tried to append this
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/
local/lib/python2.4/site-packages:${PATH}
to .bash_profile but nothing.

Where should I set this variables??

Thanks a lot
You can set environment variables for gui apps with this freeware:
http://www.versiontracker.com/dyn/moreinfo/macosx/15073

You can edit some text files as well, but this thing just makes it
much easier.

~Sean

May 11 '07 #2
On 12 Mag, 01:09, half.ital...@gmail.com wrote:
On May 11, 1:36 pm, andrea <kerny...@gmail.comwrote:
Hi everyone,
I use python on macosx with textmate as editor (great program).
I also use macport to install unix programs from the command line and
I find it great too.
Well I would like to have all my modules in the path when I'm using
textmate AND when I use the commandline (ipython), but because
textmate and the command line use different python versions they also
search in different places..
I found somewhere to write .pythonrc.py like this
#!/usr/bin/env python
import sys
PATH='/opt/local/lib/python2.4/site-packages/'
sys.path.append(PATH)
del sys
But it doesn't work either, I also tried to append this
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/
local/lib/python2.4/site-packages:${PATH}
to .bash_profile but nothing.
Where should I set this variables??
Thanks a lot

You can set environment variables for gui apps with this freeware:http://www.versiontracker.com/dyn/moreinfo/macosx/15073

You can edit some text files as well, but this thing just makes it
much easier.

~Sean
Ok thanks, but why it doesn't work setting the .bash_profile?? What
should I set manually theorically?? The problem is also that I have
many modules for python 2.4 and trying to import them from the 2.5 of
course gives errors..
I installed them with macports (compiling), how can I make them switch
to 2.5???
thanks

May 14 '07 #3
On May 14, 4:46 am, andrea <kerny...@gmail.comwrote:
On 12 Mag, 01:09, half.ital...@gmail.com wrote:
On May 11, 1:36 pm, andrea <kerny...@gmail.comwrote:
Hi everyone,
I use python on macosx with textmate as editor (great program).
I also use macport to install unix programs from the command line and
I find it great too.
Well I would like to have all my modules in the path when I'm using
textmate AND when I use the commandline (ipython), but because
textmate and the command line use different python versions they also
search in different places..
I found somewhere to write .pythonrc.py like this
#!/usr/bin/env python
import sys
PATH='/opt/local/lib/python2.4/site-packages/'
sys.path.append(PATH)
del sys
But it doesn't work either, I also tried to append this
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/
local/lib/python2.4/site-packages:${PATH}
to .bash_profile but nothing.
Where should I set this variables??
Thanks a lot
You can set environment variables for gui apps with this freeware:http://www.versiontracker.com/dyn/moreinfo/macosx/15073
You can edit some text files as well, but this thing just makes it
much easier.
~Sean

Ok thanks, but why it doesn't work setting the .bash_profile?? What
should I set manually theorically?? The problem is also that I have
many modules for python 2.4 and trying to import them from the 2.5 of
course gives errors..
I installed them with macports (compiling), how can I make them switch
to 2.5???
thanks
Gui applications are not launched through the bash shell.
The .bash_profile never gets read.

You can accomplish the same thing as the freewware app I mentioned by
editing the xml file at ~/.MacOSX/environment.plist. Its a simple xml
file with keys and their corresponding values.

Not sure about the modules. You can force a script to look for libs
in a given directory like you mentioned, but that needs to go at the
top of each python file instead of a .pythonrc file. Maybe the
modules will work with 2.5, maybe not.

~Sean

May 14 '07 #4
On 14 Mag, 23:00, half.ital...@gmail.com wrote:
On May 14, 4:46 am, andrea <kerny...@gmail.comwrote:
On 12 Mag, 01:09, half.ital...@gmail.com wrote:
On May 11, 1:36 pm, andrea <kerny...@gmail.comwrote:
Hi everyone,
I use python on macosx with textmate as editor (great program).
I also use macport to install unix programs from the command line and
I find it great too.
Well I would like to have all my modules in the path when I'm using
textmate AND when I use the commandline (ipython), but because
textmate and the command line use different python versions they also
search in different places..
I found somewhere to write .pythonrc.py like this
#!/usr/bin/env python
import sys
PATH='/opt/local/lib/python2.4/site-packages/'
sys.path.append(PATH)
del sys
But it doesn't work either, I also tried to append this
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/
local/lib/python2.4/site-packages:${PATH}
to .bash_profile but nothing.
Where should I set this variables??
Thanks a lot
You can set environment variables for gui apps with this freeware:http://www.versiontracker.com/dyn/moreinfo/macosx/15073
You can edit some text files as well, but this thing just makes it
much easier.
~Sean
Ok thanks, but why it doesn't work setting the .bash_profile?? What
should I set manually theorically?? The problem is also that I have
many modules for python 2.4 and trying to import them from the 2.5 of
course gives errors..
I installed them with macports (compiling), how can I make them switch
to 2.5???
thanks

Gui applications are not launched through the bash shell.
The .bash_profile never gets read.

You can accomplish the same thing as the freewware app I mentioned by
editing the xml file at ~/.MacOSX/environment.plist. Its a simple xml
file with keys and their corresponding values.

Not sure about the modules. You can force a script to look for libs
in a given directory like you mentioned, but that needs to go at the
top of each python file instead of a .pythonrc file. Maybe the
modules will work with 2.5, maybe not.

~Sean
If I put it on the top of every file it works, it just need to be of
the same version...
The problem is that I would like it to run everywhere, putting a
specific path is not good idea imho (I could use try except but it's
annoying).

May 20 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by martino | last post: by
reply views Thread by Neil Benn | last post: by
1 post views Thread by Steve | last post: by
14 posts views Thread by Kenneth McDonald | last post: by
3 posts views Thread by =?UTF-8?Q?Ahmad_=E3=8B=A1_Baitalmal?= | last post: by
1 post views Thread by M.-A. Lemburg | last post: by
7 posts views Thread by greg | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.