我正在尝试在 Windows 10 64 位操作系统上使用 Tensorflow 和 JetBrains PyCharm Community Edition 5.0.4 IDE 和 Python 3.7.0 。我已将 https://github.com/MicrocontrollersAndMore/TensorFlow_Tut_1_Installation_and_First_Progs 克隆到我的目录中。 Before I used Python 3.5.1 , so I’ve changed Path
in Environment Variables
and File/Settings
in Project Interpreter
to Python 3.7.0 (C:\Users\User\AppData\Local\Programs\Python\Python37-32\python.exe)
所以基本的 python 代码可以工作,但是当我尝试运行 add_two_numbers_via_TensorFlow.py
代码时,它包含 import tensorflow as tf
它给出了错误:
"C:/Users/User/Desktop/TensorFlow/TensorFlow_Tut_1_Installation_and_First_Progs/add_two_numbers_via_TensorFlow.py", line 3, in <module>
import tensorflow as tf ModuleNotFoundError: No module named 'tensorflow'
so I have to install with Command Prompt
Run as Administrator
pip3 install --upgrade tensorflow
or pip3 install --upgrade tensorflow-gpu
, but error is:
C:\WINDOWS\system32>pip3 install --upgrade tensorflow Collecting tensorflow Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow
我不确定我必须安装什么,也许另外 Python 3.6.x 64-bit
我也尝试安装 python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl
,但结果我有另一个错误:
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tensorflow\python__init__.py", line 54, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
import _pywrap_tensorflow
ModuleNotFoundError: No module named '_pywrap_tensorflow'
Error importing tensorflow. Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.
编辑 1:
尝试使用 Python 3.6.6 从 PyCharm 安装:
在 Windows 上安装 TensorFlow 说我必须下载 Anaconda for Python 3.6 版本。我不确定它是否是解决方案和错误原因
编辑 2:
Python-3.6.6-amd64.exe 属性,它是 Windows x86-64 可执行安装程序:
原文由 user10198975 发布,翻译遵循 CC BY-SA 4.0 许可协议
TensorFlow 还不适用于 Python 3.7。现在您可以返回到 Python 3.6 或 3.5 并检查 此 以获取更多信息。