I've read through a few threads with questions similar to this (this one in particular), and tried out some solutions but not succeeded yet.
I want to include python's default site-packages directory in the sys.path, for all scripts in a project. In my case this path is in my user directory:
.../Library/Python/3.7/lib/python/site-packages/
That is where packages all are installed to (e.g. scipy), and it seems inefficient to have to add sys.path.append
at the start of every script (as I've seen others say too).
I tried the solution proposed here - namely adding the above path to the list project interpreter's paths (seen at the bottom):
Red lines in the screenshot are removing some personal/work directory names. The third line is the ...lib/python3.7/site-packages
directory in the PyCharm project's directory.
After OKing these new settings, in the terminal under the same PyCharm project, if you do:
import sys
sys.path
it returns:
['',
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip',
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7',
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload',
<the path for `...lib/python3.7/site-packages` in PyCharm Project's directory>]
i.e. the path I just added isn't there, and import scipy
for example doesn't work. (I tried closing/reopening PyCharm in case that did anything, but no luck.)
It seems like the person in that post was asking the same thing as this, and it worked for them. Am I doing something wrong, or just misunderstanding?