在pip jnius安装中找不到JRE_HOME

2024-07-01 07:31:10 发布

您现在位置:Python中文网/ 问答频道 /正文

尝试从pip安装jnius(这是pip install sikuli的一个要求)。在

这是我在尝试安装时遇到的错误:

enter image description here

变量定义是否正确?在

enter image description here

有人明白为什么它总是说找不到JRE_HOME?在

编辑:我的路径变量是:

enter image description here


Tags: installpip路径编辑home定义错误sikuli
2条回答

转到“控制面板”“搜索环境变量”下的“高级系统设置” 添加一个新的环境变量并将其设置为您的路径,即 姓名:JDK逖家(与在cmd上使用python相同) 路径:C:\Program Files\Java\jdk1.8.0 U 131 保存并重新启动cmd和pip安装

这对我有用:)

在设置.py包含:

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

以某种方式您通过了第一个错误检查Unable to determine JDK_HOME 重新启动一个新窗口。在

在测试这些内容的地方编写一个小代码:

^{pr2}$

它们不区分大小写我测试过了。在

编辑:检查环境变量:

import json, os
print json.dumps(dict(os.environ), indent = 2)

相关问题 更多 >

    热门问题