使用pip或者python setup install 安装jpype总是报错,几乎搜遍全网,使用了各种解决方案,均无效,遂放弃,
换思路使用Anaconda进行安装
首先安装Anaconda,Anaconda官网的介绍为:
设想一个数据科学家可以定期将人工智能和机器学习项目大规模部署到生产中的世界,快速向决策者提供见解。这对您的业务有何影响?
Anaconda Enterprise支持您的组织,无论大小,从一台笔记本电脑上的单个用户轻松扩展到数千台计算机。没有头痛,没有IT噩梦。
然后打开Anaconda命令行 ,执行:
conda install -c conda-forge jpype1
接下来会显示以下信息表示安装成功,可能需要一点时间
(base) C:\Windows\system32>conda install -c conda-forge jpype1
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.5.12
latest version: 4.6.14
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: F:\Software\Miniconda3
added / updated specs:
- jpype1
The following packages will be downloaded:
package | build
---------------------------|-----------------
numpy-1.16.3 | py37h873a0b8_0 4.0 MB conda-forge
The following NEW packages will be INSTALLED:
intel-openmp: 2019.3-203 defaults
jpype1: 0.6.3-py37hf75dd32_1000 conda-forge
libblas: 3.8.0-7_mkl conda-forge
libcblas: 3.8.0-7_mkl conda-forge
liblapack: 3.8.0-7_mkl conda-forge
mkl: 2019.3-203 defaults
numpy: 1.16.3-py37h873a0b8_0 conda-forge
The following packages will be UPDATED:
ca-certificates: 2018.03.07-0 defaults --> 2019.3.9-hecc5488_0 conda-forge
certifi: 2018.11.29-py37_0 defaults --> 2019.3.9-py37_0 conda-forge
conda: 4.5.12-py37_0 defaults --> 4.6.14-py37_0 conda-forge
openssl: 1.1.1a-he774522_0 defaults --> 1.1.1b-hfa6e2cd_2 conda-forge
Proceed ([y]/n)?
Downloading and Extracting Packages
numpy-1.16.3 | 4.0 MB | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
安装Jpype1成功,接下来进行测试是否安装成功
首先在命令提示符中输入:Python
进入Python命令行开发模式,按顺序执行以下命令:
>>> import jpype
>>> jvmPath = jpype.getDefaultJVMPath()
>>> print(jvmPath)
成功定位到JVM的文件
F:\Software\JAVA\Java\JDK12-64bit\jre\bin\server\jvm.dll
安装成功!