Install tensorflow under windows

Recently, I plan to learn artificial intelligence. It is rumored on the Internet that the most popular framework for artificial intelligence is tensorflow. I heard that Google has started to support tensorflow on windows , so I want to install tensorflow on windows and try it out.

Install python first, and add it to the environment variable of path. It doesn't matter if you don't add it, but it is a bit troublesome to cd to the python installation directory every time you execute a python command.

There is pip.exe in the python installation directory, which is the pip command of pip install --upgrade --ignore-installed tensorflow, but the execution of this command is too slow, the download speed is only 2.1kb/s, maybe my network speed is too slow, So simply don't install it online, but download the whl file manually. From the first few lines of code executed by the pip command, you can see the name of the file installed by pip Downloading tensorflow-1.6.0-cp36-cp36m-win_amd64.whl (32.3MB), so I went to the Internet to download https://pypi.python. org/pypi/tensorflow .

Then downloaded the latest windows version whl file. Execute pip install tensorflow-1.7.0rc1-cp35-cp35m-win_amd64.whl prompts tensorflow-1.7.0rc1-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform Need to upgrade pip, or use the pip command to upgrade,

fuck If pip is enough, I won't download and install it manually, so I changed to an older version https://pypi.python.org/pypi/tensorflow/1.6.0 .
The 1.6.0 after the URL is added by myself, and execute pip install d:\TensorFlow\tensorflow-1.6.0-cp36-cp36m-win_amd64.whl again,

The previous execution has been normal, and the progress bar is running well (it seems to be downloading other dependent files, which prompts a bunch of whl files), but the result still fails. Look again, and find that the network is disconnected. The pip -V view version is still the previous version, and No upgrade. So I executed it again, staring at the network connection and the command line window, and finally, it was finished.


pip list can check which components are installed, including the tensorflow that was just installed, and the numpy and other components installed with tensorflow.
Run the following command
python
import tensorflow as tf
hello=tf.constant("hello world")
sess=tf .Session ()
print(sess.run(hello))

If you output hello world, it proves that the installation is successful, but be careful, the command import tensorflow as tf may execute slowly, so don't think it's stuck. The python command is to enter the python program, the next 4 lines are python code, print will output hello world


Try import numpy as np and find that numpy can also be used. At this point, tensorflow is installed

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325591960&siteId=291194637