天天看點

Install Tensorflow 2.0 in Conda on Windows 10

初學機器學習,安裝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           
Install Tensorflow 2.0 in Conda on Windows 10

if not, please install it first

conda install pip           
Install Tensorflow 2.0 in Conda on Windows 10
  • 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:

Install Tensorflow 2.0 in Conda on Windows 10
  • 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

Install Tensorflow 2.0 in Conda on Windows 10

Compare the %PATH% from your cmd

Install Tensorflow 2.0 in Conda on Windows 10

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.

Install Tensorflow 2.0 in Conda on Windows 10

Test it again from python command, it should be resolved

繼續閱讀