勿踩坑:win10中安装TensorFlow,并将TensorFlow导入PyCharm中。

win10中安装TensorFlow,并将TensorFlow导入PyCharm中

写在前面:
希望曾经我所遇到的坑,大家不要踩。
可以用pip直接下,但是我没成功,我用了第二种方法,Anaconda3方式下载TensorFlow

一、下载Tensorflow到win10

  1. 下载Anaconda:
    https://www.anaconda.com/distribution/
    一定要根据自己的系统类型进行选择,否则,花费半天或着一天时间都有可能。我的是64位的,但因一开始我下载了多个,并且没有意识到选错的严重性(没错,我用了两天时间,超级费时)
    勿踩坑:win10中安装TensorFlow,并将TensorFlow导入PyCharm中。

2.打开已经下载好的Anaconda3

勿踩坑:win10中安装TensorFlow,并将TensorFlow导入PyCharm中。
输入:conda create -n tensorflow_cpu pip python=3.6
成功后再次输入:conda install tensorflow

二、将TensorFlow导入PyCharm中
步骤:file->settings->Project interpreter->勿踩坑:win10中安装TensorFlow,并将TensorFlow导入PyCharm中。

勿踩坑:win10中安装TensorFlow,并将TensorFlow导入PyCharm中。

一般可以通过cmd找到python的位置:where python

勿踩坑:win10中安装TensorFlow,并将TensorFlow导入PyCharm中。我遇到的小坑是:
Tensorflow也导好啦,但是我在新建文档时,把文件名写成了tensorflow.py:直接导致了下面这个问题:

AttributeError: module ‘tensorflow’ has no attribute ‘constant’

所以一定一定不要写成tensorflow.py,哪怕是x.py也行。