将 PyCharm 定向到 Python 3.3 解释器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13988363/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Directing PyCharm to Python 3.3 interpreter?
提问by Adam
I'm not sure why I'm having so much trouble with this. I'm on OS X 10.7, and I installed Python with default settings and ran the .command file included.
我不知道为什么我在这方面遇到这么多麻烦。我使用的是 OS X 10.7,我使用默认设置安装了 Python 并运行了包含的 .command 文件。
I just want to get PyCharm working with Python 3.3, but I can't seem to find a working interpreter. The only one I can find loads instantly (gives 'distribute' and 'setuptools' packages) and gives me 'some skeletons failed to generate' errors. If I choose one of the 2.7 interpreters it loads for a while but I still get a similar error. I also get some issue with Python packaging tools not being found (usually it's 'pip').
我只是想让 PyCharm 与 Python 3.3 一起工作,但我似乎找不到工作的解释器。我可以立即找到负载的唯一一个(提供“分发”和“设置工具”包)并给我“一些骨架无法生成”错误。如果我选择 2.7 解释器之一,它会加载一段时间,但我仍然遇到类似的错误。我也遇到了一些找不到 Python 打包工具的问题(通常是“pip”)。
I've searched for a long time but can't find a solution.
我已经搜索了很长时间,但找不到解决方案。
采纳答案by CrazyCoder
PyCharm detects Python 3.3 path automatically for the Python installed from http://python.orgmpkginstaller:
PyCharm 自动检测从http://python.orgmpkg安装程序安装的 Python 的 Python 3.3 路径:


/Library/Frameworks/Python.framework/Versions/3.3/bin/python3
Once you add this interpreter to PyCharm, install the package management tools (click on the Install 'distribute', then click on Install 'pip'):
将此解释器添加到 PyCharm 后,安装包管理工具(单击Install 'distribute',然后单击Install 'pip'):


Upgrade pip to the latest version using the Upgradebutton (distribute upgrade will fail).
使用Upgrade按钮将pip 升级到最新版本(分布式升级将失败)。
Now you can install packages with the Installbutton, for example Djangocan be installed from the Interpreters dialog in PyCharm:
现在您可以使用Install按钮安装包,例如Django可以从 PyCharm 中的 Interpreters 对话框安装:


If you have problems with code completion, try File| Invalidate Caches, restart PyCharm and wait until indexing is finished. For me it worked fine out of the box:
如果您在代码完成方面遇到问题,请尝试File| Invalidate Caches, 重启 PyCharm 并等待索引完成。对我来说,它开箱即用:


回答by konrad
Python 3.3 now uses a new virtualenv mechanism called venv.
Python 3.3 现在使用一种称为 venv 的新 virtualenv 机制。
You can create one of these environments using:
您可以使用以下方法创建这些环境之一:
pyvenv myprojectname
PyCharm 3.0 does not handle these correctly. The old virtualenv system copied python binaries into the environment, while venv creates symbolic links to the python3.3binary instead. PyCharm tries to resolve all these symbolic links, until it finds a real file. This results in it ignoring your virtual environment and using the global environment instead.
PyCharm 3.0 不能正确处理这些。旧的 virtualenv 系统将 python 二进制文件复制到环境中,而 venv 则创建到python3.3二进制文件的符号链接。PyCharm 尝试解析所有这些符号链接,直到找到真正的文件。这导致它忽略您的虚拟环境并使用全局环境。
To work around this bug, you can copy the python3.3binary into your environment's binfolder and then add this as the project's interpreter in PyCharm.
要解决此错误,您可以将python3.3二进制bin文件复制到您环境的文件夹中,然后将其添加为 PyCharm 中的项目解释器。

