【发布时间】:2019-02-09 20:01:20
【问题描述】:
我正在尝试在带有JetBrains PyCharm Community Edition 5.0.4 IDE 和Python 3.7.0 的Windows 10 64 位操作系统上使用Tensorflow。我已将https://github.com/MicrocontrollersAndMore/TensorFlow_Tut_1_Installation_and_First_Progs 克隆到我的目录中。在我使用Python 3.5.1 之前,我已经将Environment Variables 中的Path 和Project Interpreter 中的File/Settings 更改为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'
所以我必须使用Command Prompt Run as Administrator pip3 install --upgrade tensorflow 或pip3 install --upgrade tensorflow-gpu 安装,但错误是:
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:
尝试从 PyCharm 安装 Python 3.6.6:
Installing TensorFlow on Windows 说我必须为 Python 3.6 版本下载Anaconda。我不确定这是否是解决方案和错误原因
编辑 2:
Python-3.6.6-amd64.exe 属性,即Windows x86-64 executable installer:
【问题讨论】:
标签: python python-3.x tensorflow pycharm python-3.7