【问题标题】:Writing ImageJ Python scripts in PyCharm在 PyCharm 中编写 ImageJ Python 脚本
【发布时间】:2018-08-13 14:24:43
【问题描述】:

我能够安装 Jython(通过自制软件),配置 PyCharm 以将其用作我的解释器,但我无法让 PyC​​harm 导入 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。任何想法将不胜感激。

【问题讨论】:

    标签: python pycharm jython imagej imagej-macro


    【解决方案1】:

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

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

    PyCharm 的设置应该类似。

    【讨论】:

    • 我在运行配置中添加了环境变量PYTHONPATH并将其设置为/Applications/ImageJ/ImageJ.app/Contents/Java,但这似乎不起作用
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-03-07
    • 1970-01-01
    • 1970-01-01
    • 2015-10-17
    • 2019-01-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多