2017-02-15 7 views
4

Bitte mich mit diesem Fehler helfenImport: Nein namens Modul tensorflow

ich das tensorflow Modul auf meinem Server installiert haben und unten ist es Informationen

[email protected]:~$ pip show tensorflow 
Name: tensorflow 
Version: 1.0.0 
Summary: TensorFlow helps the tensors flow 
Home-page: http://tensorflow.org/ 
Author: Google Inc. 
Author-email: [email protected] 
License: Apache 2.0 
Location: /home/other/15IT60R19/anaconda2/lib/python2.7/site-packages 
Requires: mock, numpy, protobuf, wheel, six 

Aber wenn ich versuche zu importieren tensorflow erhalte ich folgende Fehler

>>> import tensorflow as tf 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ImportError: No module named tensorflow 

Meine python-Version ist wie folgt

Python 2.7.12 |Anaconda 2.5.0 (64-bit)| (default, Jul 2 2016, 17:42:40) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
Anaconda is brought to you by Continuum Analytics. 
Please check out: http://continuum.io/thanks and https://anaconda.org 

Ich habe die sol1

Sol2

Ich habe keine sudo in gegeben Lösungen versucht, den Zugriff auf den Server ich nur pip verwenden können ein beliebiges Modul

Antwort

0

Ich habe versucht, Tensorflow-GPU für ein Windows 7 mit pip3 für python3.5.x zu installieren. Anstatt pip3 install --upgrade tensorflow zu tun, habe ich gerade pip install tensorflow gemacht und nachdem es fertiggestellt wurde, konnte ich endlich Tensorflow in python3.5.x importieren.

4

Überprüfen Sie, ob Tensorflow wurde erfolgreich mit installiert:

pip3 show tensorflow 

Wenn Sie so etwas wie

Name: tensorflow 
Version: 1.2.1 
Summary: TensorFlow helps the tensors flow 
Home-page: http://tensorflow.org/ 
Author: Google Inc. 
Author-email: [email protected] 
License: Apache 2.0 
Location: /usr/local/lib/python3.5/dist-packages 
Requires: bleach, markdown, html5lib, backports.weakref, werkzeug, numpy, protobuf, wheel, six 

Sie erhalten versuchen, den Pfad Ihrer tensorflow Standort Zugabe von:

export PYTHONPATH=/your/tensorflow/path:$PYTHONPATH. 
+0

auch pip zeigen tensorflow – YaBoiSandeep

7

Versuchen Sie, Tensorflow erneut mit der von Ihnen gewünschten Version und mit der Option --ignore-inst zu installieren wie:

pip install tensorflow==1.2.0 --ignore-installed 

Ich löste das gleiche Problem mit diesem Befehl.

0

Versuchen Sie, Tensorflow in der Benutzersite zu installieren - Diese Installation funktioniert nur für Sie.

pip install tensorflow --user

6

Für Anaconda3, installieren Sie einfach in Anaconda Navigator: enter image description here

+0

Installation von Tensorflow funktioniert perfekt mit Anaconda Navigator. –

0

Aktivieren Sie die virtualenv Umgebung durch einen der folgenden Befehle eingeben:

$ source ~/tensorflow/bin/# bash aktivieren, sh, ksh oder zsh
$ source ~/tensorflow/bin/activate.csh # csh oder tcsh

Hope this Hilfe

0

Dieser arbeitete für mich:

$ sudo easy_install pip 
$ sudo easy_install --upgrade six 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0-py2-none-any.whl 
$ sudo pip install --upgrade $TF_BINARY_URL 
1

ich ein grundsätzliches Problem hatte, als ich diesen Fehler erhalten.

Die "Überprüfen der Installation" Anweisungen sagen zu geben: Python

Allerdings habe ich beide 2.7 und installiert 3.6. Weil ich PIP3 verwendet tensorflow zu installieren, Typ I benötigt: python3

die richtige Version verwenden, könnte ich das "tensorflow" Modul importieren.

1

Statt der doc Verwendung des Befehls (conda create -n tensorflow pip python=2.7 # or python=3.3, etc.), die python2.7 in der Conda Umgebung installieren wollte, und hielt erroring über das Modul sagen kann nicht gefunden werden, wenn die Schritte der Installation Validierung folgenden verwendete ich conda create -n tensorflow pip python=3 sicher zu machen python3 wurde in der Umgebung installiert.

Dazu musste ich nur python anstelle von python3 bei der Validierung der Installation eingeben und der Fehler ging weg.