-1
對於Tensorflow virtualenv(建議),我遵循https://www.tensorflow.org/install/install_mac 的安裝說明。ModuleNotFoundError:在Mac OS上安裝後沒有名爲'tensorflow'的模塊
pip3 install --upgrade virtualenv
virtualenv --system-site-packages -p python3
安裝無痛,沒有錯誤信息。
我激活tensorflow並移動到不同的目錄,以避免在導入張量流到Python時與tensorflow目錄名稱混淆。結果是:
source ~/tensorflow/bin/activate
(tensorflow) Pers-MacBook-Pro:Documents per$ python3
Python 3.6.3 (default, Oct 4 2017, 06:09:15)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
出了什麼問題?我在MacOS Sierra上。我跑了診斷腳本tf_env_collect.sh提供有關環境的一些詳細信息:
== check pips ===================================================
numpy (1.13.3)
protobuf (3.4.0)
tensorflow (1.3.0)
tensorflow-tensorboard (0.1.8)
== check for virtualenv =========================================
True
== tensorflow import ============================================
tf.VERSION = 1.3.0
tf.GIT_VERSION = v1.3.0-rc2-20-g0787eee
tf.COMPILER_VERSION = v1.3.0-rc2-20-g0787eee
Sanity check: array([1], dtype=int32)
== env ==========================================================
LD_LIBRARY_PATH is unset
DYLD_LIBRARY_PATH is unset
== nvidia-smi ===================================================
./tf_env_collect.sh: line 105: nvidia-smi: command not found
== cuda libs ===================================================
您還沒有表現出你如何安裝它還是你的環境是如何設置的東西。例如,您可能使用了pip而不是pip3等。 – pvg
添加了安裝信息。 –