Anaconda3 镜像,插件,虚拟环境,内核

镜像

  • 恢复默认镜像
conda config --remove-key channels

 

插件

  • conda方式安装
conda install -c conda-forge jupyter_contrib_nbextensions
conda install -c conda-forge  jupyter_nbextensions_configurator

jupyter contrib nbextension install --user
jupyter nbextensions_configurator enable --user
  • pip方式安装
pip install jupyter_nbextensions_configurator jupyter_contrib_nbextensions

jupyter contrib nbextension install --user
jupyter nbextensions_configurator enable --user
pip install qgrid
jupyter nbextension enable --py --sys-prefix widgetsnbextension

#要想使用 Qgrid 渲染数据帧,开发者只需导入 Qgrid,然后将数据帧输入到 show_grid 函数:
import qgrid
qgrid_widget = qgrid.show_grid(df, show_toolbar=True)
qgrid_widget

数据交互

pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension

jupyter labextension install @jupyter-widgets/jupyterlab-manager


import ipywidgets as widgets
from ipywidgets import interact, interact_manual



pip install qgrid  #Installing with pip
conda install qgrid  #Installing with conda


pip install itables

from itables import init_notebook_mode
init_notebook_mode(all_interactive=True)import world_bank_data as wb
df = wb.get_countries()
df


pip install jupyter-datatables

from jupyter_datatables import init_datatables_mode
init_datatables_mode()



pip install ipyvolume #通过pip安装
conda install -c conda-forge ipyvolume  #通过conda进行安装


pip install bqplot 
conda install -c conda-forge bqplot 


pip install livelossplot

from livelossplot import PlotLossesKeras
model.fit(X_train, Y_train,
          epochs=10,
          validation_data=(X_test, Y_test),
          callbacks=[PlotLossesKeras()],
          verbose=0)


pip install tensorwatch

pip install -U polyaxon

pip install handcalcs

pip install jupyternotify

import numpy as np
%timeit np.random.normal(size=1000)

https://zhuanlan.zhihu.com/p/360446521
https://zhuanlan.zhihu.com/p/350421120
https://www.tiobe.com/tiobe-index/
https://www.w3cschool.cn/assembly/assembly-plastic.html
https://www.runoob.com/php/php-intro.html
https://www.runoob.com/js/js-howto.html
https://www.runoob.com/csharp/csharp-tutorial.html
https://www.runoob.com/postgresql/postgresql-create-table.html

 

虚拟环境

  • 查看安装了哪些包
conda list
  • 查看当前存在哪些虚拟环境
conda env list 
conda info -e
  • 检查更新当前conda
conda update conda
  • Python创建虚拟环境
conda create -n your_env_name python=x.x
  • 激活或者切换虚拟环境

Linux:

source activate your_env_nam

Windows:

activate your_env_name
  • 关闭虚拟环境

Linux:

source deactivate your_env_nam

Windows:

deactivate your_env_name
  • 删除虚拟环境
conda remove -n your_env_name --all

 

虚拟环境改名字

# 新建一个新的环境,克隆原环境
conda create --name NewName --clone OldName
# 删除原环境
conda remove --name OldName --all 
# 激活新环境
conda activate NewName 

 

内核

  • 查看内核版本
python -m ipykernel --version
  • 查看当前存在哪些内核
jupyter kernelspec list
  • 安装内核
python -m pip install ipykernel
  • 添加内核
python -m ipykernel install --user --name=your_kernelname  --display-name your_showname

## pip 安装
pip install jupyter


## 安装jupyterlab
pip install jupyterlab

## 安装依赖关系(npm, nodejs)
pip install npm
conda install -c conda-forge nodejs


生成配置文件 默认保存:~/.jupyter/jupyter_notebook_config.py
jupyter notebook --generate-config
或
jupyter lab --generate-config


2. 配置密码

现在最近版本的jupyter可以直接用以下命令:

$ jupyter notebook password



 配置一下 jupyter_notebook_config.py 文件

c.NotebookApp.ip = '*'
c.NotebookApp.allow_root = True
c.NotebookApp.port = 8888



## 启动notebook
jupyter notebook --no-browser --port=8889
## 启动lab
jupyter lab --no-browser --port=8889



Jupyter notebook 更换kernel
由于jupyter notebook访问的时候,默认使用了anaconda的base环境,这里就需要更换环境

安装ipykernel
conda install nb_conda_kernels

将环境写入notebook的kernel中
python -m ipykernel install --user --name 环境名称 --display-name "显示的名称"



查看安装的内核和位置
jupyter kernelspec list

删除 kernel
jupyter kernelspec remove tensorflow


然后 需要在你需要切换的虚拟环境下安装 内核,命令如下
我是在 TensorFlow2的环境下安装的

conda install ipykernel




软件包"anaconda clean"(可从Anaconda平台获得),需要安全卸载。

复制代码
conda install anaconda-clean   # install the package anaconda clean
anaconda-clean --yes           # clean all anaconda related files and directories 
rm -rf ~/anaconda3             # removes the entire anaconda directory

rm -rf ~/.anaconda_backup       # anaconda clean creates a back_up of files/dirs, remove it 
                                # (conda list; cmd shouldn't respond after the clean up)

https://zhuanlan.zhihu.com/p/161221247

https://blog.csdn.net/weixin_42416683/article/details/112300633

https://zhuanlan.zhihu.com/p/166425946

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值