TensorFlow:pip install tensorflow报错(使用Anaconda作为环境)

一.问题描述

使用pip install tensorflow命令安装tensorflow的时候报错:

 Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

 

二.问题分析

1.版本问题

查看本地python版本:

C:\Users\95232>python --version
Python 3.7.1

写作该篇文章时,tensorflow官网对python版本的要求(https://www.tensorflow.org/install/pip)——“Requires Python 3.4, 3.5, or 3.6”,所以可发现是python版本导致该问题产生。

三.解决方法

1.创建一个名为tf_venv,python=3.5的虚拟环境,然后再安装TensorFlow.

C:\Users\95232>cd /d D:\Tool\Anoconda\envs # 进入到需要创建虚拟环境的目录

D:\Tool\Anoconda\envs>conda create -n tf_venv python=3.5 # 创建名为tf_venv的虚拟环境

D:\Tool\Anoconda\envs>activate tf_venv # 激活虚拟环境

(tf_venv) D:\Tool\Anoconda\envs>pip install tensorflow # 安装tensorflow

(tf_venv) D:\Tool\Anoconda\envs>pip install tensorflow-gpu # 安装tensorflow-gpu


猜你喜欢

转载自blog.csdn.net/cckavin/article/details/86559382