JRE_HOME not found on pip jnius installation

孤者浪人 提交于 2019-12-01 22:06:00

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 :)

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