【发布时间】:2018-03-28 11:55:03
【问题描述】:
我已按照https://www.tensorflow.org/install/install_mac 上的安装说明进行操作 对于 Tensorflow virtualenv(推荐)。
pip3 install --upgrade virtualenv
virtualenv --system-site-packages -p python3
安装过程很轻松,没有错误消息。
在将 tensorflow 导入 Python 时,我激活了 tensorflow 并移动到不同的目录以避免与 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 等。
-
添加了安装信息。
标签: tensorflow pip virtualenv macos-sierra python-3.6