【发布时间】:2019-01-10 04:40:08
【问题描述】:
我在带有 High Sierra 的 Macbook Pro 上使用默认版本的 Python(2.7)。我已经使用以下命令安装了默认版本的 tensorflow,即 1.9:
pip -V
>>>pip 18.0 from /usr/local/lib/python2.7/site-packages/pip-18.0-py2.7.egg/pip (python 2.7)
pip install tensorflow
pip list
>>>tensorflow 1.9.0
然后我启动 python:
python
Python 2.7.10 (default, Oct 6 2017, 22:29:07)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
然后我尝试导入 tensorflow 并得到这个错误:
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tensorflow
>>>
我多次尝试按照说明进行操作,但均未成功。我会很感激任何帮助。谢谢。
【问题讨论】:
-
你用什么来运行你的代码?空闲?,间谍?皮查姆?终端? ...
-
我使用的是mac终端。
-
你有没有使用Anaconda加载某个版本的python?
-
Python 3 已经推出 10 年了,为什么还要使用 Apple 发布的古老的 Python 2.7?
-
@jmh 我的机器上有 Anaconda,它工作正常。我需要非 anaconda 环境来实现 Python 和 R 之间的连接。
标签: macos python-2.7 tensorflow