Trying to install jnius
from pip (it is a requirement to pip install sikuli
).
This is the error I get when I am trying to install:
Are the variables correctly defined?
Does anyone understand why it keeps saying that it can't find JRE_HOME
?
Edit: My path variable is:
The setup.py contains:
jdk_home = environ.get('JDK_HOME')
if not jdk_home:
jdk_home = subprocess.Popen('readlink -f /usr/bin/javac | sed "s:bin/javac::"',
shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
if not jdk_home:
raise Exception('Unable to determine JDK_HOME')
jre_home = environ.get('JRE_HOME')
if not jre_home:
jre_home = subprocess.Popen('readlink -f /usr/bin/java | sed "s:bin/java::"',
shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
if not jre_home:
raise Exception('Unable to determine JRE_HOME')
Somehow you pass the first error check Unable to determine JDK_HOME
start a new cmd window and try again.
Write a small code where you test these:
import os
print os.environ.get('JDK_HOME')
print os.environ.get('JRE_HOME')
They are not case sensitive I tested it.
EDIT: Check the environment variables:
import json, os
print json.dumps(dict(os.environ), indent = 2)
Go to Control Panel Search For Advance System Settings under Environment variables ADD a new Environment variable and set it equal to Your path i.e Name:JDK_HOME(Same you did for using python on cmd) Path: C:\Program Files\Java\jdk1.8.0_131 save and restrart cmd and pip install
This worked for me :)
来源:https://stackoverflow.com/questions/38686809/jre-home-not-found-on-pip-jnius-installation