Adding a library directory to PyCharm

On Ubuntu 15.10, I am running PyCharm Community Edition version 2016.1. I have a Python file that calls import tensorflow , a module that depends on the CUDA library libcudart.so.7.5 . When I run this file, the following error message appears:

 ImportError: libcudart.so.7.5: cannot open shared object file: No such file or directory 

Now the libcudart.so.7.5 file is located on my machine in /usr/local/cuda-7.5/lib64 . And in Pycharm I added this path to File->Settings->Project Interpreter->Interpreter Paths . So, I am puzzled by why PyCharm cannot find libcudart.so.7.5 , given that the directory containing it is listed as an interpreter path.

Also, if I run this file from the command line, it works fine without the above error. In my .bashrc , I have a line:

 export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH 

Thus, this apparently allows you to find the library file. But how can I get PyCharm to find a library? My understanding was that adding a path to the interpreter path was a solution, but it seems like this might be wrong ...

Thanks!

+5
source share
2 answers

PyCharm's runtime environment is independent of your .bashrc.

Assuming that the environment variable set with .bashrc that makes it work in your shell, you should try to set this environment variable in PyCharm startup configurations.

In Run -> Edit Configurations... add an environment variable:

enter image description here

+8
source

I had the same issue with the Windows 7 desktop. Pycharm just messed up the installation of the modules. I tried to load pygame, but adding the path to the command line did not work. Fortunately, this video helped me: https://www.youtube.com/watch?v=MdGoAnFP-mU&list=WL&index=2 Just follow and work with any module (it would be a little different). Hope this helps!

0
source

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


All Articles