Clion can't find external module in python file
<p>Hell everyone,<br>
I'm using CLion for a C++ project.<br>
I have a some python files in this project too. ( boost python).<br>
The python files import a module generated by cmake.<br>
It works properly if I do :  </p>

<blockquote>
  <p>$ cd buildDir<br>
      $ python mypythonFile.py</p>
</blockquote>

<p>But in CLion, It can't find the lib imported.<br>
So no autoCompletion, etc and everything is red.<br>
I tried this in the cmakeList.txt:  </p>

<blockquote>
  <p>set_target_properties(mymodule PROPERTIES ENVIRONMENT
  "PYTHONPATH=$PYTHONPATH:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" )</p>
</blockquote>

<p>I thought since CLion use cmake, he'll use this PYTHONPATH but it doesn't work.<br>
I saw similar questions on CLion's forum but with no answer.<br>
So i thought I'd ask here.  Â </p>

<p>Thank you all.<br>
Cheers</p>

<p>CLion uses CMake for creation a project model (extracts compiler switches for c/cpp files, detects files that need to be compiled and etc), but it does not inherit the environment. At least in current implementation.</p>

<p>The problem is that there is a <a href="https://youtrack.jetbrains.com/issue/CPP-3090" rel="nofollow">bug</a> in CLion about overriding PYTHONPATH. As a workaround you can set PYTHONPATH in .gdbinit manually.</p>

python cmake clion