Can't set up PYTHONPATH in PyCharm

Viewed 2270

I'm getting an error while executing a function from a module in PyCharm 5:

/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/apple/Dropbox/PycharmProjects/work/2-chapter.py
...
...
AttributeError: 'module' object has no attribute 'corpus'

That is supposed to be nltk.corpus.

After having played with Project Structure (in Preferences) and adding there both /usr/local/lib/python2.7/site-packages and /Library/Python/2.7/site-packages paths, nothing still works out. enter image description here

I am wondering whether I need to add this path as well /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 ?

The problem is I don't have it. I only have path ...Python.framework/Versions/3.5, although I have already installed python 2.7 as well and the interpreter uses python 2.7.5.

enter image description here

The PYTHONPATH is:

$ echo $PYTHONPATH
:/usr/local/lib/python2.7/site-packages

I also tried adding

import sys
sys.path.append("/usr/local/lib/python2.7/site-packages")

to the module I'm talking about, it also didn't work.

2 Answers
Related