Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
757 views
in Technique[技术] by (71.8m points)

python - Jnius installation bug, "Unable to determine JDK_HOME"

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:userssmappdatalocalemppip-install-vu2sb5jniussetup.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:userssmappdatalocalemppip-install-vu2sb5jnius

I restarted CMD, but it didn't help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...