JRE_HOME not found on pip jnius installation

不羁的心 提交于 2019-12-04 04:33:22

问题


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:


回答1:


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)



回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!