Environment in Ubuntu (and PyCharm) terminal does not match editor window. How can I ensure an exact match?

已回答

If I use the Ubuntu terminal to start Python2.7, I can import the modules I need, and all functions are available to me. They are also available to me when I start ipython from within the PyCharm terminal window. But when I import them into my python code, it tells me it cannot find the functions, which makes coding more difficult. How can i ensure an exact match between the environments in the editor and the terminal windows of PyCharm? 

0

Hello!

Please run this script in Pycharm and in Terminal to compare environment: https://gist.github.com/vlasovskikh/968240f877117cb6c882.

0
Avatar
Permanently deleted user

Hi Anna,

Thanks for that - very interesting results. I ran the script using...

  1. PyCharm run function
  2. PyCharm terminal 
  3. Ubuntu terminal

Most of the folders were shared across all three PATHs. However, [1] lacked "/home/<user>/Programmes/pymol/bin", and lacked "/usr/games", neither of which explains the issues I'm having with rdkit usage inside PyCharm. 

I am able to run rdkit using the PyCharm terminal [2] and Ubuntu terminal [3], but not the standard PyCharm run function. The only difference I can see using your script is that the sys.path order is slightly different in [1] compared to [2] & [3]. rdkit-Release appears first in [1], but the other way around in [2] and [3] (also in this order (rdkit second) in PYTHONPATH). I'm not sure how important this is. 

/home/<user>/Programmes/rdkit-Release_2016_03_1',
/home/<user>/Programmes/openbabel-install/lib/python2.7/site-packages',


I had some difficulty with the installation of rdkit, and needed to specify the "LD_LIBRARY_PATH" variable:

[2 - PyCharm terminal LD_LIBRARY_PATH]

  • /home/<user>/Programmes/rdkit-Release_2016_03_1/lib:
  • /home/<user>/Programmes/rdkit-Release_2016_03_1/lib:
  • /home/<user>/Programmes/pycharm-community-2017.1.5/bin:

[1 - PyCharm run LD_LIBRARY_PATH]

  • /home/<user>/Programmes/pycharm-community-2017.1.5/bin',
  • "''

[3 - Ubuntu terminal LD_LIBRARY_PATH]

  • '/home/<user>/Programmes/pycharm-community-2017.1.5/bin'

How can I force PyCharm 'run' to see the LD_LIBRARY_PATH? And PYTHONPATH?

Thanks,

Ant

0

请先登录再写评论。