LearnExcelTechnology, Follow WeChat Official Account:
excelperfect
Introduction: Here I record the issues encountered while installing TensorFlow and their solutions, so that I can refer back to them later and for the reference of friends facing similar problems.
Recently, I have been focusing on studying Deep Learning Illustrated. When I reached Chapter 8, I tried to run the code in the book, and it prompted me to install the TensorFlow framework. So, following the usual method, I opened the command line interface and entered:
pip install tensorflow
However, it always resulted in an error.
I tinkered for a long time and even tried installing at different times, but it was still ineffective. I had no choice but to search online while trying to solve the problem, and in the end, I managed to fix it.
First, download Anaconda. Note that it should be the latest version of Anaconda. I downloaded it from the following website:
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
Since my computer is running a 64-bit Win10 system, I downloaded the 2020.7.24 file Anaconda3-2020.07-Windows-x86_64.exe.
After downloading, double-click to install. Note that at the “Advanced Options” step, it is recommended to check both checkboxes (i.e., check the checkbox before “Add Anaconda3 to the system PATH environment variable”).
Once the installation is complete, click the start menu in the lower left corner, find and open “Anaconda Prompt (anaconda3),” and the command line interface will appear.
Enter the command:
python -m pip install –upgrade pip
to upgrade the pip version.
Then enter the command:
pip install tensorflow-cpu==2.2.0 -i https://pypi.douban.com/simple/
to install TensorFlow.
Everything went smoothly!
However, when I tried to run the command:
import tensorflow
, I encountered an error as shown in Figure 1, indicating that the specified module could not be found.
Figure 1
At this point, it is necessary to download and install vc_redist.x64.exe, which can be downloaded from:
https://support.microsoft.com/zh-cn/help/2977003/the-latest-supported-visual-c-downloads
After installation, restart the computer and run it again.
However, when running the code from the book, I encountered an error indicating that the keras library could not be found. This is easy to solve by entering the following command in the command line interface:
pip install keras
to install the keras library.
At this point, the program code can run smoothly.
Feel free to leave comments below to improve this article, allowing more people to learn more perfect knowledge.
Welcome to the Knowledge Planet: PerfectExcelCommunity, for technical exchange and questions, and to obtain more electronic materials.