python环境准备

安装Anaconda并配置环境对应的python版本为:3.7.4:
【Python】Tensorflow-cpu-1.15版本环境准备_win10

pip配置

在对应用户目录下,本机示例如下:
【Python】Tensorflow-cpu-1.15版本环境准备_tensorflow_02
在pip目录下创建pip.ini内容如下:

[global]

index-url=https://pypi.douban.com/simple

[install]

trusted-host=pypi.douban.com

在环境变量PATH添加pip路径:​​%HOMEPATH%\pip​

tensorflow安装

​pip install six numpy wrapt h5py​​​ 创建一个虚拟环境:
​F:\tf-course>virtualenv --system-site-packages -p python3.7 ./env​​ 激活虚拟环境:
​F:\tf-course>env\Scripts\activate​​ 安装tensorflow
​(env) F:\tf-cource>pip install tensorflow-cpu==1.15​

验证tensorlfow可用

(env) F:\tf-cource>python
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32

Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation

Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello=tf.constant("Hello Tensorflow")
>>> sess=tf.Session()
>>> sess.run(hello)
b'Hello Tensorflow'
>>>