Windows环境下在jupyter中安装tensorflow

您所在的位置:网站首页 安装tensorflow库清华镜像 Windows环境下在jupyter中安装tensorflow

Windows环境下在jupyter中安装tensorflow

2024-07-08 04:34| 来源: 网络整理| 查看: 265

1下载安装anaconda

首先,我们在anaconda官网上下载anaconda,具体的下载安装过程不再细说,在windows终端使用conda --version来验证是否安装成功:

C:\Users\hp>conda --version conda 4.3.30

接下来使用jupyter notebook进入jupyter环境:

C:\Users\hp>jupyter notebook [I 09:34:32.864 NotebookApp] JupyterLab alpha preview extension loaded from C:\Users\hp\Anaconda3\lib\site-packages\jupyterlab JupyterLab v0.27.0 Known labextensions: [I 09:34:32.864 NotebookApp] Running the core application with no additional extensions or settings [I 09:34:33.400 NotebookApp] Serving notebooks from local directory: C:\Users\hp [I 09:34:33.400 NotebookApp] 0 active kernels [I 09:34:33.400 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/ [I 09:34:33.400 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

在浏览器中输入http://localhost:8888/即可进入jupyter的开发环境。

2.配置tensorflow环境

在终端输入conda create -n tensorflow python=3.5,即可创建python版本为3.5的tensorflow环境,并使用activate tensorflow进行tensorflow环境:

C:\Users\hp>activate tensorflow (tensorflow) C:\Users\hp>

并输入pip install tensorflow进行tensorflow的安装,鉴于安装时间过慢(且很大概率安装不成功),这里推荐使用清华的镜像进行下载:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow

接下来分别使用conda install jupyter;conda install ipython;conda install spyder,在tensorflow环境中进行jupyter、ipython以及spyder的安装:

(tensorflow) C:\Users\hp>conda install jupyter (tensorflow) C:\Users\hp>conda install ipython (tensorflow) C:\Users\hp>conda install spyder 3.在tensorflow环境中进入jupyter

安装完成后退出windows终端,然后重新进入windows终端,使用activate tensorflow进入所创建的tensorflow环境,在tensorflow环境中输入jupyter notebook,即可进入可使用tensorflow的jupyter环境,每次进入jupyter环境的时候,重复这一段操作即可:(同理,可进入tensorflow环境下的ipython以及spyder)

C:\Users\hp>activate tensorflow (tensorflow) C:\Users\hp>jupyter notebook [I 10:02:49.472 NotebookApp] Serving notebooks from local directory: C:\Users\hp [I 10:02:49.472 NotebookApp] 0 active kernels [I 10:02:49.472 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/ [I 10:02:49.472 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). #在jupyter中输入这段代码,运行成功则说明安装成功 import tensorflow as tf print(tf.__version__) 1.6.0

 

 

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3