tensorflow安装及在anaconda3 Jupyter NoteBook,pycharm环境中使用

本文详细介绍了如何在Anaconda3和PyCharm环境中安装并使用TensorFlow。从通过清华镜像快速下载TensorFlow,到验证安装成功,再到解决在Jupyter Notebook中使用时的报错问题,以及在PyCharm中配置环境遇到的FutureWarning和CPU指令集兼容性问题,提供了全程的解决方案。

tensorflow安装

使用TensorFlow实现卷积神经网络,首先需要安装tensorflow,配置环境,在环境配置中遇到了一系列问题。
首先关于tensorflow安装,根据TensorFlow的环境配置与安装做到此博客前TensorFlow安装前一步后根据Tensorflow教程(1)Tensorflow的下载和安装从清华镜像下载的tensorflow(这样下载会比较快)之后,再次根据TensorFlow的环境配置与安装在命令行验证了tensorflow的安装是否成功,成功安装

tensorflow在anaconda3 Jupyter NoteBook中使用

安装好tensorflow环境后,在anaconda3 Jupyter Notebook中使用import tensorflow as tf报错ModuleNotFoundError: No module named 'tensorflow'在网上找了很多解决方法有的说在终端执行conda install nb_conda我弄了好久中间又出现了一些新的问题,没有成功,之后看了一篇博客在虚拟环境中运行Jupyter Notebook解决办法问题得以解决。
另外我在命令行输入jupyter notebook报错,

(tensorflow) C: Users \ jupyter notebook
E: \sof tware \rj \bi anji \Anaconda3 \1ib\site-packages \setuptools \distutils patch. py:25: UserWarning: Distutils was imported
before Setuptools. This usage is di scouraged and may exhibit undesirable behaviors or errors. Please use Setuptools ob
ects directly or at least import Setuptools first.
warnings. warn (
Traceback (most recent call last) :
File" E: \software \rj\bianji \Anaconda3 Scripts \jupyter notebook script. py,line 6,in <module>
from notebook. notebookapp import main
File E: \software \r j\bianji \Anaconda3\1ib\site-packages notebook \notebookapp. py,line 49, in <module>
from zmq. eventloop import ioloop
File" E: \software \r j\bi anji \Anaconda3\lib\site-packages\zmq\_ init_ 。 py",line 47,in <modu1e>
from zmq import backend
File" E: \software\rj\bianji \Anaconda3\lib\site-packages \zmq \backend\_ init_ py", line 40, in <modu1e>
reraise (*exc_ info
File” E: \software \rj\bianji \Anaconda3\1ib\site-packages \zmq \utils\sixcerpt.py", line 34,in reraise
raise value
File" E: \software \rj\bi anji Anaconda3 \1ib\site-packages \zmq backend\_ init_ py ,line 27,in <module>
_ns 三select_ backend (first)
File E: \software \rj \bianji \Anaconda3 \1ib \si te-packages \zmq \backend\select. py",line 28, in select_ backend
mod 
import__ (name, fromlistapublic api )
File" E: \sof tware \rj \bianji \Anaconda3 \1ib\site- packages \zmq \backend\cython_ init_ 。 py,line 6,in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed while importing error:找不到指定的模块。

在这里插入图片描述

用博客解决anaconda3下的jupyter notebook在命令行中无法运行问题得以解决

tensorflow在pycharm环境使用

第一个: import tensorflow as tf总是显示No module named tensorflow
解决方法:在参考了用pycharm配置好anaconda后,调用 tensorflow总是显示No module named tensorflow之后,意识到是自己项目python环境配置问题,之后对项目环境进行配置,选择File->settings
在这里插入图片描述
点击add
在这里插入图片描述
选择自己安装好的虚拟环境中的python.exe
在这里插入图片描述
环境配置好后,import tensorflow as tf 不再报错,点击运行,又遇到如下问题:
问题1、FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecate
解决方法:解决python调用TensorFlow时出现FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecate
问题2、Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
解决方法:成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2

在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值