错误:命令错误,退出状态为1:python setup.py egg_info检查日志以获取完整的命令输出-尝试安装pyjnius时

问题描述

我一直在尝试通过pip命令pip install pyjniuspip install git+git://github.com/kivy/pyjnius.git安装pyjnius,但似乎都在返回以下错误代码

  Collecting git+git://github.com/kivy/pyjnius.git
  cloning git://github.com/kivy/pyjnius.git to c:\temp\pip-req-build-7d_4quh2

    ERROR: Command errored out with exit status 1:
     command: 'c:\users\user\pycharmprojects\kivy_project\venv\scripts\python
.exe' -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'C:\\Temp\\pip-
req-build-7d_4quh2\\setup.py'"'"'; __file__='"'"'C:\\Temp\\pip-req-build-7d_4
quh2\\setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=
f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,_
_file__,'"'"'exec'"'"'))' egg_info --egg-base 'C:\Temp\pip-pip-egg-info-6mu1
ulvw'
         cwd: C:\Temp\pip-req-build-7d_4quh2\
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>",line 1,in <module>
      File "C:\Temp\pip-req-build-7d_4quh2\setup.py",line 95,in <module>
        compile_native_invocation_handler(*get_possible_homes(PLATFORM))
      File "jnius\env.py",line 172,in get_possible_homes
        get_jdk_home(platform),File "jnius\env.py",line 142,in get_jdk_home
        raise Exception('Unable to determine JDK_HOME')
    Exception: Unable to determine JDK_HOME
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check
 the logs for full command output.

请任何人给我一个解决方案,因为我对事物的这种了解有点陌生。

解决方法

错误消息显示失败原因:

Exception: Unable to determine JDK_HOME

确保已安装JDK(Java开发工具包)。如果已安装JDK,但仍无法使用,请尝试将JDK_HOME环境变量设置为指向正确的位置。

在此处引发错误消息,以供参考:https://github.com/kivy/pyjnius/blob/7dd6c8e679302526d6e86bdddeca343a3f0b54c7/jnius/env.py#L118-L144