Using spyder IDE in OSX variable - DYLD_LIBRARY_PATH not available in spyder

I use Spyder as an IDE (on OSX Mavericks) for a project, and I need to connect to the Postgres database. Therefore, I use the psycopg2 package.

When I initially started python by itself in the terminal, it did not start because I did not have DYLD_LIBRARY_PATH. To fix this, I added DYLD_LIBRARY_PATH = / Library / PostgreSQL / 9.3 / lib to ~ / .bashrc and then sourced ~ / .bashrc.

This fix when I open a terminal, run python and import psycopg2 - great!

But when I open Spyder through the launch application, it does not seem to have access to the DYLD_LIBRARY_PATH environment variable, so I cannot import psycopg2. Is there a way to ensure that python sessions in spyder use the same environment variables?

So far i tried

  • Adding DYLD_LIBRARY_PATH = / Library / PostgreSQL / 9.3 / lib to ~ / .bashrc ~. / Profile and ~ / .bash_profile, but this does not seem to work for Spyder (it works when starting python from terminal)

  • Create ~ / .MacOSX / environment.plist and add DYLD_LIBRARY_PATH. It didn't seem to do anything. (if I did it right ... after that, do I need the source environment.plist or something to activate?)

  • In a Spyder session, os are imported and os.environ ['DYLD_LIBRARY_PATH'] = '/Library/PostgreSQL/9.3/lib is started. DYLD_LIBRARY_PATH seems to be located in os.environ, but it still does not work.

  • Create launchd.conf file with setenv DYLD_LIBRARY_PATH / Library / PostgreSQL / 9.3 / lib '. I'm not sure I did it right, but as on reboot, my computer did not turn on, and I had to go into recovery mode to remove launchd.conf. (Can someone give an example of what this file should look like?)

  • Running spyder directly from the terminal instead of starting. But this is a completely different kettle of fish, he said that I do not have PyQT4.6 + (but I do !!)

Does anyone know how to get spyder to recognize DYLD_LIBRARY_PATH?

+5
source share

Source: https://habr.com/ru/post/1207015/


All Articles