Eclipse:使用PyDev连接到自定义python解释器 [英] Eclipse: connect to custom python interpreter with PyDev

查看:123
本文介绍了Eclipse:使用PyDev连接到自定义python解释器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢Eclipse和PyDev,因为它始终具有我需要的功能.这次,我想将PyDev连接到已经运行的解释器.这就是我的解释器嵌入在我的游戏应用程序中的原因.如果可以简化操作,我也可以从Eclipse启动游戏应用程序.

I love Eclipse and PyDev because it always has the features I need. This time I'd like to connect PyDev to my interpreter that is already running. My interpreter is embedded in my game application, that's why. If it would make it easier, I can also start the game application from Eclipse.

但是,我尝试将我的游戏.exe添加到PyDev的解释器配置中,但无法启动,因为.exe需要位于.exe文件夹中的某些.cfg文件. Ecplise似乎没有在其环境中执行.exe文件.我该怎么办?

However, I've tried to add my game .exe in the interpreter configuration in PyDev but it cannot be started because the .exe need some .cfg files that are located in the .exe's folder. Ecplise seems to not execute the .exe file in its environment. How could I do it?

所有这些的主要原因是我希望能够对在应用程序内部创建的python对象进行代码完成,并让Eclipse知道它们.类似于远程变量调试.

The main reason for all this is that I want to be able have code completion for python objects that are created inside my application and let Eclipse know about them. Similar to remote variable debugging.

推荐答案

我不确定我是否100%理解您的核心问题,但这应该可以回答我想知道的事情:

I'm not 100% sure if I understand your core question but this should answer what I think you want to know:

您不会将编译的游戏可执行文件添加为解释器,因为它不是python解释器. Eclipse要求一个 python 解释器.

You would not add your compiled game executable as an interpreter as it wouldn't be a python interpreter. Eclipse asks for a python interpreter.

如果要使用自定义安装的python在自定义环境/PYTHONPATH中运行代码,请转到 Window-> Preferences-> PyDev-> Interpreter-Python .在这里,您可以在其中添加自定义安装的Python作为预设,并选择要包含在该解释器预设的PYTHONPATH中的环境路径(确保您不添加项目的源代码).路径本身,Eclipse将在您运行项目时添加它们.

If you want to run your code in a custom environment/PYTHONPATH with a (custom) installation of python, go to Window -> Preferences -> PyDev -> Interpreter - Python. That's where you can add your custom installation of Python as a preset and select its environment paths that are to be included in the PYTHONPATH for that interpreter preset (make sure you don't include the project's source paths themselves, Eclipse will add them when you run the project).

完成后,转到项目首选项,然后从列表( PyDev-解释器/语法)中选择新创建的解释器预设.

Once done, go to your project preferences and select the newly created interpreter preset from the list (PyDev - Interpreter/Grammar).

只要使用PyDev编辑器并正确设置PYTHONPATH环境,您就可以完成代码.

You will get code-completion as long as you use the PyDev editor(s) and have your PYTHONPATH environment correctly set-up.

希望有帮助.

这篇关于Eclipse:使用PyDev连接到自定义python解释器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆