Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid Python SDK Error while using python 3.4 on PyCharm

When I switch my PyCharm to use Python 3.4.3 I am getting the error:

Invalid Python SDK

Also PyCharm does not automatically find the Python 3.4 interpreter for me, even though it is on desired path /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4.

See screenshot:

enter image description here

Although the interpreter does work. I am able to get correct output as expected, but code completion related to python 3.4 is not working.

e.g. print("hello world!) still shows an error on the editor, but the console shows the correct output.

like image 670
rayonst Avatar asked Aug 05 '15 18:08

rayonst


2 Answers

This also happened to me. I renamed a repository and then my virtual environment got stuck in the old path.

I grepped all configuration files and could not find any reference to the old one.

What finally solved the problem was to clear caches with the option File > Invalidate Caches / Restart...:

enter image description here

like image 185
fedorqui 'SO stop harming' Avatar answered Oct 20 '22 10:10

fedorqui 'SO stop harming'


I had the same issue. Try to comment/remove the PYTHONPATH variable in your ~/.bash_profile

#export PYTHONPATH=/usr/local/lib/python2.7/site-packages/

If it does not help it also may be useful to look in the idea.log for the errors:

/Users/username/Library/Logs/PyCharm40/idea.log

I had the following errors:

Your PYTHONPATH points to a site-packages dir for Python 2.x but you are running Python 3.x!
     PYTHONPATH is currently: "/usr/local/lib/python2.7/site-packages/"
     You should `unset PYTHONPATH` to fix this.
like image 7
mennanov Avatar answered Oct 20 '22 11:10

mennanov