在 OSX 上将 pydev 与 Eclipse 结合使用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/703925/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:37:19  来源:igfitidea点击:

Using pydev with Eclipse on OSX

pythoneclipse

提问by Sunit

I setup PyDev with this path for the python interpreter /System/Library/Frameworks/Python.framework/Versions/2.5/Python since the one under /usr/bin were alias and Eclipse won't select it. I can run my python script now but cannot run the shell as an external tool. The message I get is

我使用此路径为 python 解释器 /System/Library/Frameworks/Python.framework/Versions/2.5/Python 设置了 PyDev,因为 /usr/bin 下的那个是别名,Eclipse 不会选择它。我现在可以运行我的 python 脚本,但不能将 shell 作为外部工具运行。我得到的消息是

variable references empty selection ${resource_loc}

变量引用空选择 ${resource_loc}

Same if I use {container_loc}

如果我使用 {container_loc} 也一样

Any thoughts ?

有什么想法吗 ?

Sunit

太阳系

采纳答案by Maurizio

I installed the Python.org version as well, this is a must.

我也安装了 Python.org 版本,这是必须的。

I finally got PyDev working in Eclipse by pointing the interpreter to:

通过将解释器指向以下位置,我终于让 PyDev 在 Eclipse 中工作:

/Library/Frameworks/Python.framework/Versions/2.6/bin/python

manually. If you don't do it manually (by using the Autoconfig) it seems to not find the right version.

手动。如果您不手动执行(通过使用 Autoconfig),它似乎找不到正确的版本。

回答by Gunnlaugur Briem

Common practice seems to be to install an up-to-date Python 2.5 from python.org and use that instead of the system installation. I saw that recommended here and there when I got started on Mac OS X.

通常的做法似乎是从 python.org 安装最新的 Python 2.5 并使用它而不是系统安装。当我开始使用 Mac OS X 时,我在这里和那里看到了推荐。

It installs under /Library(as opposed to /System/Library) so the system Python is intact. Pydev has /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python as its configured Python interpreter and all is well.

它安装在/Library(而不是/System/Library)下,因此系统 Python 完好无损。Pydev 将 /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python 作为其配置的 Python 解释器,一切正常。

Can't state for sure that your trouble is due only to using the system's Python installation; in any case this way I have no trouble. Also, this way when you fiddle with your development environment (install things in site-packages, upgrade Python), anything that uses the system Python is sure to be unaffected.

无法确定您的问题仅是由于使用系统的 Python 安装造成的;无论如何,这样我就没有麻烦了。此外,这样当你摆弄你的开发环境(在站点包中安装东西,升级 Python)时,任何使用系统 Python 的东西肯定不会受到影响。

回答by user1409219

I know this is a ancient post... but, in case of some newbee like me to get the better answer.

我知道这是一个古老的帖子......但是,如果像我这样的新手可以获得更好的答案。

I just using "Eclipse Marketplace" from the "Help" menu and search for keyword "python" or "PyDev" to get PyDev, and get it successfully installed.

我只是使用“帮助”菜单中的“Eclipse Marketplace”并搜索关键字“python”或“PyDev”来获取 PyDev,并成功安装它。

AND, you should add PyDev to the top-right dock.

并且,您应该将 PyDev 添加到右上角的停靠栏。

For the instance, my eclipse on my laptop's OSX is (Version: Indigo Service Release 2 Build id: 20120216-1857).

例如,我在笔记本电脑 OSX 上的日食是(版本:Indigo Service Release 2 Build id:20120216-1857)。

Have fun, folks! :)

玩得开心,伙计们!:)

回答by VonC

I believe ${resource_loc}or ${container_loc}(without any argument) are based on the current selection in your workbench when you are launching your script.

我相信${resource_loc}${container_loc}(没有任何参数)是基于您启动脚本时工作台中的当前选择。

So are you selecting the right resource when selecting that script through the "external tool" runner ?
At least, click on the project name before you run one of the external programs.
Note: it works with a selection in the Navigator or Package Explorers views(the latest might not be available in PyDev environment though)

那么在通过“外部工具”运行程序选择该脚本时,您是否选择了正确的资源?
至少,在运行外部程序之一之前单击项目名称。
注意:它适用于Navigator 或 Package Explorers 视图中的选择(但最新的可能在 PyDev 环境中不可用)