在 PyCharm 上使用 python 3.4 时出现无效的 Python SDK 错误 [英] Invalid Python SDK Error while using python 3.4 on PyCharm

查看:864
本文介绍了在 PyCharm 上使用 python 3.4 时出现无效的 Python SDK 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将 PyCharm 切换为使用 Python 3.4.3 时,出现错误:

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

无效的 Python SDK

Invalid Python SDK

此外,PyCharm 不会自动为我找到 Python 3.4 解释器,即使它位于所需的路径 /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4.

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.

看截图:

虽然解释器确实有效.我能够按预期获得正确的输出,但与 python 3.4 相关的代码完成不起作用.

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.

例如print("hello world!) 仍然在编辑器上显示错误,但控制台显示正确的输出.

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

推荐答案

我遇到了同样的问题.尝试注释/删除 ~/.bash_profile

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/

如果它没有帮助,在idea.log中查找错误也可能有用:

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

我有以下错误:

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.

这篇关于在 PyCharm 上使用 python 3.4 时出现无效的 Python SDK 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆