【问题标题】:Python with Java, PyJNIus installationPython 与 Java,PyJNIus 安装
【发布时间】:2016-05-25 11:47:17
【问题描述】:

为了在 Python 中使用带有绑定的 Java,我正在安装以下内容: https://github.com/kivy/pyjnius

我得到了这个错误:它似乎试图将 C++ 文件头编译到 Java_HOME.... 中,这看起来很奇怪:

    Installing collected packages: jnius
      Running setup.py install for jnius
        Complete output from command D:\_devs\Python01\WinPython-64-2710\python-2.7.10.amd64\python.exe -c "import setuptools, tokenize;__file__='f:\\usertemp\\pip-build-wdmlwj\\jnius\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record f:\usertemp\pip-f_a0kd-record\install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_py
        running build_ext
        skipping 'jnius\jnius.c' Cython extension (up-to-date)
        building 'jnius' extension
        D:\_devs\Python01\WinPython-64-2710\python-2.7.10.amd64\Scripts\gcc.exe -mdll -O -Wall -IE:\_devs\JDK7\include -IE:\_devs\JDK7\include\linux -ID:\_devs\Python01\WinPython-64-2710\python-2.7.10.amd64\include -ID:\_devs\Python01\WinPython-64-2710\python-2.7.10.amd64\PC -c jnius\jnius.c -o build\temp.win-amd64-2.7\Release\jnius\jnius.o
        In file included from jnius\jnius.c:256:0:
        E:\_devs\JDK7\include/jni.h:45:20: fatal error: jni_md.h: No such file or directory
         #include "jni_md.h"
                            ^
        compilation terminated.
        error: command 'D:\\_devs\\Python01\\WinPython-64-2710\\python-2.7.10.amd64\\Scripts\\gcc.exe' failed with exit status 1

【问题讨论】:

标签: java python pyjnius


【解决方案1】:

基于错误,我认为在 Windows 操作系统中编译 Jnius 扩展所需的 Python 软件包缺少部分存在问题,老实说,在 Windows 中你会发现比 Ubuntu 更多的错误,我不知道为什么,我从 Windows 切换到 Ubuntu,现在,编程变得更好更容易,但这里有一个解决方法:

在 Ubuntu 中,我知道执行此操作的命令,但对于 Windows,请看这里: https://preshing.com/20141108/how-to-install-the-latest-gcc-on-windows/

这里: https://solarianprogrammer.com/2019/11/05/install-gcc-windows/

我能给你的最好建议是,安装最新稳定的 Ubuntu 官方软件,无需卸载 Windows,Ubuntu 和 Windows 都可以

【讨论】:

    猜你喜欢
    • 2014-07-19
    • 2014-06-26
    • 2020-07-22
    • 2018-03-02
    • 2018-03-04
    • 2021-04-06
    • 2017-08-18
    • 2020-07-01
    • 2021-01-14
    相关资源
    最近更新 更多