2017-05-07 4 views
1

Ich versuche Maven zu installieren tensorflow verwenden, und führen Sie den Code:
TensorFlow nicht finden können, die native Bibliothek

System.out.println(TensorFlow.version()); 

aber der folgende Fehler auftritt:

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) 


Sein Aussehen wie Java konnte die native Bibliothek nicht finden, obwohl ich glaube, dass Maven alle notwendigen Gläser und Bibliotheken installiert hat (e. G. .dll).

meine Maven pom:

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

HINWEIS: Ich Eclipse IDE verwenden.

+0

Ich denke, Sie müssen TensorFlow auf Ihrem System installieren. Siehe [hier] (https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/package-summary). Maven Abhängigkeiten erhalten Sie die benötigten Bibliotheken aus dem Repository –

+0

Wie läuft das Programm? Verwenden Sie 'mvn compile exec: java' oder etwas anderes? – ash

+0

[Überprüfen Sie diese Antwort] (https://stackoverflow.com/questions/42350009/) Es wäre hilfreich ~! –

Antwort

1

Ich hatte den gleichen Fehler und löste es, indem ich JDK 1.7 (64 Bit) installiere und die Projekt-JRE auf die in Eclipse umstellte. Zuvor habe ich JDK 1.7, aber die 32-Bit-Version verwendet. Ich nehme an, dass, wenn Python 64 Bit von Tensorflow installiert/benötigt wird, ein 64 Bit JDK ebenfalls verwendet werden muss.

Verwandte Themen