sudo pip3 install jnius安装jnius报错如下:
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-q5r7tbes/jnius/setup.py'"'"'; __file__='"'"'/tmp/pip-install-q5r7tbes/jnius/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /tmp/pip-install-q5r7tbes/jnius/
Complete output (7 lines):
readlink: 缺少操作数
Try 'readlink --help' for more information.
Traceback (most recent call last):
File "
File "/tmp/pip-install-q5r7tbes/jnius/setup.py", line 111, in
raise Exception('Unable to determine JDK_HOME')
Exception: Unable to determine JDK_HOME
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
如图
在网上找原因发现可能是JDK环境变量问题,但是我JAVA_HOME环境变量已经配置正确了,尝试添加JRE_HOME
环境变量配置:
sduo vi /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_192(这里配置自己的jdk路径)
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
配置完成后执行
source /etc/profile
配置完环境变量后发现没有报JDK_HOME错误,但是还是报错,错误信息如下:
在网上查找原因可能是运行java应用程序所需的默认jre没有安装javac,必须运行以下命令才能获得javac
test@test:~$ sudo apt-get install openjdk-8*
安装完成后再执行
sudo pip3 install pyjnius
安装成功!没有报错