安装Anaconda使用TensoFlow

1、下载anaconda 运行安装  https://www.anaconda.com/download-success

2、anacanda powershell prompt 
conda create -n itmamba_anaconda1 python=3.7 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda清华源镜像 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

3、添加清华源到conda的配置
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
使用conda的深度学习和机器学习相关包,添加conda-forge通道
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
确认是否已经配置成功,可以使用以下命令查看当前配置
conda config --show

4、查看是否环境创建成功
conda info -e
切换环境
conda activate itmamba_anaconda1

5、安装包
pip install tensorflow -i https://pypi.doubanio.com/simple

pip install matplotlib -i https://pypi.doubanio.com/simple

pip install numpy -i https://pypi.doubanio.com/simple

pip install pandas -i https://pypi.doubanio.com/simple

pip install jupyter -i https://pypi.doubanio.com/simple

6、打开jupyter notebook
jupyter notebook

7、配置路径
jupyter notebook --generate-config

Writing default config to: C:\Users\35181\.jupyter\jupyter_notebook_config.py

python -m pip install jupyter_contrib_nbextensions

jupyter contrib nbextension install --user --skip-running-check

pip install autopep8 -i https://pypi.doubanio.com/simple

jupyter notebook --generate-config

如果报错 安装较低版本的python包

pip install -i https://pypi.doubanio.com/simple pyqt5==5.12.3

pip install -i https://pypi.doubanio.com/simple pyqtwebegine==5.12.1

打开juoyter_notebook_config.py
修改c.NotebookApp.notebook_dir = 'D:\\PYTHON\\PROJECT\\jupyter_notebook_project'

8、安装autopep8
pip install autopep8 -i https://pypi.doubanio.com/simple

9、安装提示
python -m pip install jupyter_contrib_nbextensions -i https://pypi.doubanio.com/simple
jupyter contrib nbextension install --user --skip-running-check

10、安装主题
pip install jupyterthemes -i https://pypi.doubanio.com/simple
jt -t grade3 -f consolamono -fs 140 -altp -tfs 13 -nfs 115 -ofs 14 -cellw 80% -T

11、打开jupyter notebook
首页-Nvextensions 配置勾选Table of contents、contrib_nbextensions_help_item、jupyter-js-widgets/extension、Nbextensions dashboard tab、Autopep8、CodeFontSize、Hinterland、Nbextensions edit menu item、spellchecker、Toggle all line numbers

新建python文件 new Python3(ipykernel)

import tensorflow as tf
import numpy as np
import pandas as pd
print("hello world")
print(tf.__version__)
print(np.__version__)
print(pd.__version__)
运行结果:
hello world
2.11.0
1.21.6
1.3.5
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章