I cannot seem to add the project PYTHONPATH

已回答

Hi,

I cannot import the project modules.

Somehow Pycharm does not seem to set the env variable PYTHONPATH.

 

I have done the following:

  • Settings → Project: (name project) → Project Srtucture
  • I added the root and all the modules as source

RIght click the module I try to debug:

  • Modify Run Configuration
  • Modify Options
  • Add Contents Roots to PYTHONPATH
  • Add Source Roots to PYTHONPATH

When I debug, it fails to import from the other modules

When I type in the shell the following I get no value for PYTHONPATH

>>> import os
... os.environ["PYTHONPATH"]
Traceback (most recent call last):
 File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Exec
   exec(exp, global_vars, local_vars)
   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "<input>", line 1, in <module>
 File "<frozen os>", line 716, in __getitem__
KeyError: 'PYTHONPATH'
0

Hi Anthony, this issue requires thorough investigation, please create an issue on YouTrack: https://youtrack.jetbrains.com/issues/PY and attach all relevant information for quicker resolution

0

帖子评论已关闭。