简体   繁体   English

在 OSX 上使用 pydev 和 Eclipse

[英]Using pydev with Eclipse on OSX

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.我使用 python 解释器 /System/Library/Frameworks/Python.framework/Versions/2.5/Python 的路径设置 PyDev,因为 /usr/bin 下的那个是别名并且 Eclipse 不会 Z999425941E8。 I can run my python script now but cannot run the shell as an external tool.我现在可以运行我的 python 脚本,但不能将 shell 作为外部工具运行。 The message I get is我得到的信息是

variable references empty selection ${resource_loc}变量引用空选择 ${resource_loc}

Same if I use {container_loc}如果我使用 {container_loc} 也是一样

Any thoughts?有什么想法吗?

Sunit苏尼特

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:我终于通过将解释器指向:

/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),它似乎找不到正确的版本。

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.常见的做法似乎是从 python.org 安装最新的 Python 2.5 并使用它而不是系统安装。 I saw that recommended here and there when I got started on Mac OS X.当我开始使用 Mac OS X 时,我在这里和那里看到了推荐的内容。

It installs under /Library (as opposed to /System/Library ) so the system Python is intact.它安装在/Library (而不是/System/Library )下,因此系统 Python 完好无损。 Pydev has /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python as its configured Python interpreter and all is well. 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;不能 state 确定你的麻烦只是因为使用系统的 Python 安装; 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 的东西肯定不会受到影响。

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 上的 eclipse 是(版本:Indigo Service Release 2 Build id:20120216-1857)。

Have fun, folks: :)玩得开心,伙计们::)

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 环境中不可用)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM