在PyCharm中编写ImageJ Python脚本

时间:2018-03-05 20:21:12

标签: python pycharm jython imagej imagej-macro

我可以安装Jython(通过自制程序),配置PyCharm将其用作我的解释器,但我无法让PyCharm导入ij。

/usr/local/bin/jython -Dpython.path=/tmp/python /tmp/python/test.py
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.python.core.PySystemState (file:/usr/local/Cellar/jython/2.7.1/libexec/jython.jar) to method java.io.Console.encoding()
WARNING: Please consider reporting this to the maintainers of org.python.core.PySystemState
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Traceback (most recent call last):
  File "/tmp/python/test.py", line 1, in <module>
    import ij
ImportError: No module named ij

我的目标是能够使用IDE和比脚本编辑器中当前存在的更高级的调试工具编写ImageJ宏。 Python将是我首选的脚本语言,PyCharm是我首选的IDE。任何想法都将不胜感激。

1 个答案:

答案 0 :(得分:0)

您需要将IDE配置为使用Jython解释器,并在项目的ij.jar上使用PYTHONPATH

对于Eclipse IDE,Emanuele Martini在此ImageJ forum post中有详细说明。

PyCharm的设置应该类似。