MAC环境下 PyCharm中的Python interpreter不正确的修复

MAC环境下,安装有两个版本的Python:

Python2:(v2.7.10)为默认Python版本,运行Python2的脚本,直接运行Python app.py即可。

Python3:(v3.6.5)运行Python3的脚本,需要运行Python3 app.py。

PyCharm: Professional 2017.1.4


在PyCharm中导入Python3的应用代码,无法直接运行,提示Python版本不正确(没有正确的解释器)。

打开Run/Debug Configurations,其中Python interpreter中只有一项“Python 2.7.10(/usr/bin/python)”,没有Python3的选项。


解决方法: 

在PyCharm中的菜单File->Default Settings...中,找到“Project Interpreter”,然后选择3.6.5那一项保存。



再次进入Run/Debug Configurations,其中Python interpreter中就有“Python 3.6.5(...)”的选项了,选择此项目后,Python3的代码就可以正常运行调试了。


[附]Mac版本的 Pycharm(PyCharm 2017.1.4)是试用版的,需要注册:

直接打开pycharm,选License server激活,输入:http://idea.imsxm.com


猜你喜欢

转载自blog.csdn.net/youngwhz1/article/details/80421978