Install Tensorflow 2.0 in Conda on Windows 10

  1. 云栖社区>
  2. 博客>
  3. 正文

Install Tensorflow 2.0 in Conda on Windows 10

hopecho 2019-10-19 09:25:52 浏览1305

初学机器学习,安装Tensorflow时遇到了点问题,环境是WIN10+CONDA,简单做个笔记记录一下。

正常通过CONDA INSTALL是无法安装TF2.0的,所以只能通过PIP安装,如果你安装后没有任何问题,那么恭喜你,因为我没这么幸运。安装后我遇到了下面的问题,这个问题我花了1个多小时才得以解决,因众所周知的原因,只能BAIDU+BING,尝试了好些方案后找到如下亲测靠谱方案,供大家参考。

简言之,其实就是环境变量没设对的问题,把CONDA的一些路径加入到PATH当中去就行了

ImportError: DLL load failed: The specified module could not be found.

Since there is no tensorflow 2.0 in Conda, you will have to resort to install it from pip command, following are steps to install tensorflow 2.0.

make sure you have pip command on your environment

conda list pip

image

if not, please install it first

conda install pip

image

  • Step 1: install tensorflow from pip, it will install the latest tensorflow which is 2.0 as of now @2019-10-19
pip install tensorflow
  • Step 2: open cmd to test tesorflow
import tensorflow as tf

The result should be as below:
image

  • Step 3 (additional): in case you have the following error message, please config your PATH environment
ImportError: DLL load failed: The specified module could not be found.

Open your Anaconda Prompt to check %PATH% configuration
image

Compare the %PATH% from your cmd

image

Add those missing path about Anacona to your account path or system path,below path is only for reference purpose which may vary from yours.
image

Test it again from python command, it should be resolved