MAC上的PyCharm中默认的python解释器是python2的,windows下的没用过不是很清楚,所以特来记录下设置python3解释器的过程。
[b]python3的查找与安装[/b]
如果电脑中没有安装python3可以用brewhome来安装,简单记录下
// 查看python版本
python --version
python3 --version
// 搜索python
brew search python
[img]http://files.jb51.net/file_images/article/201712/201712150844201.png[/img]
// 安装python3
brew install python3
然后经过一个漫长的过程就安装好了,好,圆规正题
[b]设置PyCharm[/b]
打开PyCharm的偏好设置
[img]http://files.jb51.net/file_images/article/201712/201712150844212.png[/img]
// 搜索Interpreter
Interpreter
点击更多按钮,选择【Create VirtualEnv】
[img]http://files.jb51.net/file_images/article/201712/201712150844213.png[/img]
[img]http://files.jb51.net/file_images/article/201712/201712150844214.png[/img]
[img]http://files.jb51.net/file_images/article/201712/201712150844215.png[/img]
Name随便写,位置可以跟我一样放到[.virtualenvs]下
/Users/(userName)/.virtualenvs
[img]http://files.jb51.net/file_images/article/201712/201712150844216.png[/img]
查看python位置
[img]http://files.jb51.net/file_images/article/201712/201712150844217.png[/img]
// python2
which python
// python3
which python3
选择【Base interpreter】python3的执行文件位置
[img]http://files.jb51.net/file_images/article/201712/201712150844218.png[/img]
[img]http://files.jb51.net/file_images/article/201712/201712150844229.png[/img]
点击OK就好了,接下来设置python3做为默认的 解释器吧
[img]http://files.jb51.net/file_images/article/201712/2017121508442210.png[/img]