Anaconda中安装Tensorflow的过程

Anaconda中如何安装Tensorflow

(1) 建立一个 conda 计算环境名字叫tensorflow:

conda create -n tensorflow python=3.8

一定要指定python版本,否则安装失败。

(2)激活tensorflow环境,然后使用其中的 pip 安装 TensorFlow。当使用easy_install使用–ignore-installed标记防止错误的产生。

activate tensorflow

(tensorflow)$ # Your prompt should change
(3)安装tensorflow

pip install tensorflow

这里推荐用镜像安装,要不然太慢了。
(4)验证安装

python
import tensorflow as tf

表示成功。

问题1:出现这样的情况
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out.
直接指定特定源安装

pip --default-timeout=100 install tensorflow==2.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

问题2:如果出现错误一:Cannot uninstall ‘wrapt’.
更新wrapt

pip install -U --ignore-installed wrapt enum34 simplejson netaddr

问题3:如果输入之后,会发现它让你升级pip的版本才可以,那么我们就先升级pip的版本

python -m pip install --upgrade pip

如果显示这样,表示安装成功!!!

在这里插入图片描述

2.检测是否安装成功

1.输入:python
2.import tensorflow as tf
3.tf.version
4.tf.path
如下图表示安装成功

在这里插入图片描述

作者:huanglianghuang原文地址:https://blog.csdn.net/qq_41511783/article/details/124680287

%s 个评论

要回复文章请先登录注册