通过 pydev 的 bumblebee 运行 python 脚本
我正在 Linux 上尝试使用 Bumblebee 和 Ironhide;两者都是在混合图形系统中的快速图形卡上运行代码的方法。
工作方式是,如果我在终端中运行它: 优化齿轮 这将在快速卡上运行程序 glxgears, 但如果我跑 GLX齿轮 它将在慢速显卡上运行,因为这是标准行为。
现在我如何在 Pydev 中以“optirun”作为前缀运行我的 python 代码? 我想从命令行来看它必须是这样的: optirun /usr/bin/python2.6 mypythonscript.py
在 PyDev 内的运行配置中,我找不到将“optirun”添加到解释器调用之前的方法 我尝试制作一个 shell 脚本,调用 optirun /usr/bin/python2.6 并传递所有参数,但 PyDev 并不那么容易被愚弄,并抱怨相关解释器已配置。 如果能够从 PyDev 做到这一点那就太好了,因为这样我就不必担心对我制作的其他模块的依赖。
我怎样才能做到这一点?
亲切的问候,
乔斯特。
I am trying out things with Bumblebee and Ironhide on Linux; both are ways to run code on the fast graphic cards in hybrid graphics systems.
The way that works is that if I run this in the terminal:
optirun glxgears
this will run the programme glxgears on the fast card,
but if i run
glxgears
it will run on the slow graphics card as that is the standard behaviour.
Now how can I run my python code in Pydev with ´optirun´ as a prefix ?
I guess from the command-line it would have to be something like:
optirun /usr/bin/python2.6 mypythonscript.py
In the run configurations within PyDev I can not find a way to prepend ´optirun´ to the call to the interpreter
I tried making a shell script that calls optirun /usr/bin/python2.6 and passes all parameters, but PyDev is not that easily fooled and complains that the interpreter in question is already configured.
It would be great to be able to do this from PyDev, since then I don´t have to worry about the dependencies on other modules I made.
How can I achieve this ?
kind regards,
Joost.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我实际上没有尝试过,但您可以检查以下操作是否有效:
编辑plugins\org.python.pydev_XXX\PySrc\interpreterInfo.py 并在行中执行:
sys.stdout.write('EXECUTABLE:%s| \n' % 可执行文件)
使其为: sys.stdout.write('EXECUTABLE:optirun %s|\n' % 可执行文件)
然后,配置一个新的解释器——使用时那个解释器,任何 python 调用都应该通过 optirun...如果失败,我认为唯一的其他方法是编辑 PyDev 本身以添加一个选项来指定“前缀可执行文件”(硬编码应该很容易:编辑 org. python.pydev.debug.ui.launching.PythonRunnerConfig.getCommandLine(boolean) 将 optirun 添加到 cmdArgs - 请参阅: http://pydev.org/developers.html 了解有关获取代码/编译代码的详细信息)。
I haven't actually tried it, but you can check if the following works:
Edit plugins\org.python.pydev_XXX\PySrc\interpreterInfo.py and in the line that does:
sys.stdout.write('EXECUTABLE:%s|\n' % executable)
Make it: sys.stdout.write('EXECUTABLE:optirun %s|\n' % executable)
Then, contfigure a new interpreter -- when using that interpreter, any python call should go through the optirun... If that fails, I think that the only other way would be editing PyDev itself to add an option to specify a 'prefix executable' (hardcoding should be easy: edit org.python.pydev.debug.ui.launching.PythonRunnerConfig.getCommandLine(boolean) to add optirun to the cmdArgs -- see: http://pydev.org/developers.html for details on getting the code/compiling it).