问题
I tried to install jnius Python module by typing 'pip install jnius' in CMD. This is the message I got:
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\sm\appdata\local\temp\pip-install-vu2sb5\jnius\setup.py", line 111, in <module>
raise Exception('Unable to determine JDK_HOME')
Exception: Unable to determine JDK_HOME
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
c:\users\sm\appdata\local\temp\pip-install-vu2sb5\jnius\
I restarted CMD, but it didn't help.
回答1:
I have finally resolved it. I have installed Cython before this happened and I installed both Java JDK and JRE after @Chris comment. And I have also added JAVA_HOME and JDK_HOME to system variables.Thank you @Chris, but it didn't resolve problem completely.
Then I got another error message. There was written that I have to install Microsoft Visual C++ Compiler for Python 2.7 from this page: https://www.microsoft.com/en-us/download/confirmation.aspx?id=44266
After that I tried to install jnius again but the error message said that permission is denied so I ran CMD as administrator and finally installed jnius by typing pip install jnius.
I spent a lot of time to resolve it and hope that it will help everyone with same or similar problem.
回答2:
The thing that worked for me was simply adding JAVA_HOME and JDK_HOME variables.
来源:https://stackoverflow.com/questions/52067834/jnius-installation-bug-unable-to-determine-jdk-home