我用pip安装时没有名为tensorflow的模块

时间:2019-09-14 18:58:51

标签: python macos tensorflow

我是Tensorflow和机器学习的新手。我正在PC上关注一些教程,到目前为止一切正常,使用python导入和测试都可以。我试图在Macbook上测试代码。所以我在命令提示符下使用Pip3安装了Tensorflow,Matplotlib和Pandas。但是,当我在Mac上运行代码时,我得到了:

Traceback (most recent call last):
   File "test.py", line 3, in <module>
import tensorflow as ts
ModuleNotFoundError: No module named 'tensorflow'

有输出和Pip3列表:

Result of the pip install tensorflow

pip3 show tensorflow

给我:

Name: tensorflow
Version: 2.0.0a0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: /usr/local/lib/python3.7/site-packages
Requires: google-pasta, gast, absl-py, astor, keras-preprocessing, keras-applications, six,           numpy, wheel, grpcio, protobuf, tf-estimator-nightly, termcolor, tb-nightly
Required-by:

然后:

pip3 list

给我:

Package              Version
-------------------- --------------------
absl-py              0.8.0
astor                0.8.0
cycler               0.10.0
gast                 0.3.2
google-pasta         0.1.7
grpcio               1.23.0
h5py                 2.10.0
Keras-Applications   1.0.8
Keras-Preprocessing  1.1.0
kiwisolver           1.1.0
Markdown             3.1.1
matplotlib           3.1.1
numpy                1.17.2
pandas               0.25.1
pip                  19.1.1
protobuf             3.9.1
pyparsing            2.4.2
python-dateutil      2.8.0
pytz                 2019.2
setuptools           41.0.1
six                  1.12.0
tb-nightly           1.14.0a20190301
tensorflow           2.0.0a0
termcolor            1.1.0
tf-estimator-nightly 1.14.0.dev2019030115
virtualenv           16.7.5
Werkzeug             0.15.6
wheel                0.33.4

我在Mac上执行的操作与在PC上执行的操作完全相同,但是我在Mac上具有多个版本的Python,也许这是问题所在,但我只是不知道如何解决。

对不起,我的英语,我不习惯在这样的论坛上发帖,感谢您的帮助,如果您愿意,我可以提供有关我的问题的更多信息。

0 个答案:

没有答案