Eclipse / PyCharm中的jython设置 [英] jython setup in Eclipse/PyCharm
问题描述
在Mac上使用Python 2.7,而IDE是PyCharm。需要在Python脚本中使用一些Java函数,并且更喜欢使用Python的导入,例如来自com.abc import fooFunc 的,这样我就可以使用
fooFunc
作为Python函数。 Java函数在 goo.jar
中定义。
Using Python 2.7 on Mac, and IDE is PyCharm. Need to use some Java functions inside Python script, and prefer to use import of Python, for example from com.a.b.c import fooFunc
, so that I can use fooFunc
in Python script as a Python function. The Java functions are defined in goo.jar
.
我的问题是,我应该在哪里放置 goo.jar
文件,以便Python / PyCharm可以找到jar文件?
My question is, where should I place the goo.jar
file, so that Python/PyCharm could find the jar file?
编辑1 ,为PyDev for Jython项目添加屏幕快照,
Edit 1, add screen snapshot for PyDev for Jython project,
编辑2 ,为自动配置错误消息添加屏幕快照,
Edit 2, add screen snapshot for auto-config error message,
编辑3 ,无法从Eclipse中选择已安装的jython解释器,
Edit 3, cannot select installed jython interpreter from Eclipse,
编辑4 ,只能在配置jython解释器时选择.jar文件,
Edit 4, can only select .jar file when configuring jython interpreter,
编辑5 ,程序运行正常,但是来自控制台的红色警报错误消息,
Edit 5, program runs ok but with red alert error messages from console,
推荐答案
跟进在上面的评论中,是的,如果您使用pydev进行eclipse,那么这只是允许使用eclipse编写python代码的插件。要安装jython,有很多指南,但它归结为两个步骤:
Follow up on the comments above, yes if you are using pydev for eclipse, then that's just the plugin that allows for writing python code with eclipse. To install jython, there are a number of guides out there, but it boils down to a two step process:
- 下载并安装 jython。安装过程通常会告诉你jython的安装位置。
- 下一步配置 pycharm以包含jython的位置。由于IDE的jetbrains系列非常相似,我将jython添加到intelliJ的方法是文件>项目结构> SDK> +> Python SDK>导航到jython二进制文件
- Download and install jython. The installation process will usually tell you where jython is installed
- Next Configure pycharm to include the location of jython. As the jetbrains family of IDE's are very much the same, the way I added jython to intelliJ is to do File > Project Structure > SDK > + > Python SDK > Navigate to the jython binary
这篇关于Eclipse / PyCharm中的jython设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!