人工智能环境配置

一、tensorflow环境配置教程

        step 1:查看tensorflow\keras\python对应版本

        step 2、创建虚拟环境:

# 创建虚拟环境
conda create -n 'my_env' python=3.7

# 删除虚拟环境
conda remove -n 'you_env_name' --all
# 删除虚拟环境中包
conda remove --name 'you_env_name' 'you_package_name'

        step 3、激活环境:

conda activate my_env

        step 4、如电脑有gpu,则键入:如没有则跳过

conda install cudatoolkit=10.1

        step 5、如电脑有gpu,则键入:如没有则跳过

conda install cudnn=7.6 

        step 6、安装tensorflow

pip install tensorflow==2.1

        step 7、验证是否安装成功:

python

import tensorflow as tf
tf.__version__

二、虚拟环境内核加入kernel

        step 1:进入虚拟环境

activate my_env

        step 2:在虚拟环境中安装ipython

conda install ipykernel

        step 3:添加虚拟环境的python kernel:

python -m ipykernel install --name my_env

        其他相关语句:

# 查看kernel列表
jupyter kernelspec list

# 删除指定kernel
jupyter kernelspec remove 'your_kernel_name'

三、jupyter安装插件,实现代码提示等功能

        step 1:安装jupyter_contrib_nbextensions扩展工具

pip install jupyter_contrib_nbextensions -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/
jupyter contrib nbextension install  --user

        step 2:安装jupyter_nbextensions_configurator扩展工具

pip install jupyter_nbextensions_configurator -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/
jupyter nbextensions_configurator enable --user

        step 3:重启notebook,勾选对应栏目,实现配置

                安装成功后,会在http://localhost:8888/tree中出现Nbextensions;勾选Codefolding、Hinterland等实现配置。

四、jupyter notebook背景主题、字体大小设置

        step 1:安装jupyter主题:

pip install jupyterthemes -i https://mirrors.aliyun.com/pypi/simple

        step 2:更新jupyter主题

pip install --upgrade jupyterthemes

        step 3:查看可用主题

jt -l

        step 4:设置主题

jt -t monokai -f fira -fs 13 -cellw 90% -ofs 11 -dfs 11 -T -N

# -f(字体)  -fs(字体大小) -cellw(占屏比或宽度)  -ofs(输出段的字号)  -T(显示工具栏)  -N(显示自己主机名)

        step 5:恢复默认主题

jt -r

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值