我正在尝试使用Maven安装tensorflow,并运行以下代码:
System.out.println(TensorFlow.version());但会发生以下错误:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot find TensorFlow native library for OS: windows, architecture: x86. See https://github.com/tensorflow/tensorflow/tree/master/java/README.md for possible solutions (such as building the library from source).
at org.tensorflow.NativeLibrary.load(NativeLibrary.java:66)
at org.tensorflow.TensorFlow.init(TensorFlow.java:27)
at org.tensorflow.TensorFlow.<clinit>(TensorFlow.java:31)
at ai.advance.project.App.main(App.java:12)虽然我相信maven安装了所有必要的jars和库(例如.dll),但它看起来像java找不到本机库。
我的行尸官:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ai.advance</groupId>
<artifactId>project</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<exec.mainClass>HelloTF</exec.mainClass>
<!-- The sample code requires at least JDK 1.7. -->
<!-- The maven compiler plugin defaults to a lower version -->
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
</project>注意:我正在使用eclipse。
发布于 2017-12-03 19:14:14
我也犯了同样的错误,并通过安装JDK1.7 (64位)并将项目的JRE切换到Eclipse中来解决它。以前我使用的是JDK1.7,但是32位版本。我认为,如果Tensorflow安装/需要Python 64位,也必须使用64位JDK。
https://stackoverflow.com/questions/43830660
复制相似问题