开发者

Aptana (eclipse) does not recognize modifications to PATH written in .bashrc

I encountered and solved this problem earlier this day and now I run into something similar but in another context.

When I fire up python (2.7) in my mac Terminal (Mac OS Lion) and do

import oursql

everything is fine.

When I do the same within a python script in the Aptana IDE I get the following error.

    Traceback (most recent call last):
  File "/Users/salah/Documents/Aptana Studio 3 Workspace/pubmap/src/scripts/parse_all_dblp_authors.py", line 10, in <module>
    import oursql
ImportError: dlopen(/Library/Python/2.7/site-packages/oursql.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Library/Python/2.7/site-packages/oursql.so
  Reason: image not found

This is the same error as in the problem above which I used to solve by adding

PATH=${PATH}:/usr/local/mysql/bin
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/"

to .bashrc and

开发者_运维问答if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi

to .bash_profile.

Why does this have no effect on Aptana? By the way Aptana is a derivate of eclipse so everything relevant to eclipse should be relevant to Aptana, too - at least I think so...

Edit:

A suggestion by Peter in his answer below brought me a possible solution. Just set the path right into the interpreter Options of Python in Aptana/Eclipse/Pydev. See the following Screenshot:

Aptana (eclipse) does not recognize modifications to PATH written in .bashrc


It's been a while since I used Pydev, but the Pydev docs on configuring the interpreter are probably worth a look.

Python IDEs usually let you configure the environment python is run in when you run from the IDE.

Also, having .bashrc change your $PATH will only change the environment variable for bash sessions. Unless you run Aptana from bash changing your .bashrc won't change the envirnment variables Aptana gets. See setting-environment-variables-in-os-x.


Aptana Studio does not read .bashrc. However it does include other files in the following order:

if [ -f /etc/profile ] ; then . /etc/profile; fi   

if [ -f ~/.bash_profile ] ; then . ~/.bash_profile;
elif [ -f ~/.bash_login ] ; then . ~/.bash_login;
elif [ -f ~/.profile ] ; then . ~/.profile;

[[ -f ~/.aptanarc ]] && . ~/.aptanarc

Cheers, Max

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜