Conda 与 Jupyter 配合使用Anaconda

2021-12-28 10:22:54 浏览数 (1)

Anaconda

下载地址 https://www.anaconda.com/products/individual

创建语法

代码语言:javascript复制
创建环境:conda create -n mlenv python=3.7  
激活环境:conda activate mlenv   
命令说明:mlenv是环境名;python=3.7是环境的使用版本是3.7;

其它语法

  • 查看工具的版本信息conda --version
  • 查看含版本更多信息conda info
  • 显示所有环境的列表conda info --env (conda info -e)
  • 查看安装了 哪 些 包conda list
  • 在当前环境中安装包conda install scrapy
  • 在指定环境中安装包conda install -n python36 scrapy
  • 在当前环境中更新包conda update scrapy
  • 在指定环境中更新包conda update -n python36 scrapy
  • 更新当前环境所有包conda update --all
  • 在当前环境中删除包conda remove scrapy
  • 在指定环境中删除包conda remove -n python2 scrapy
添加清华镜像
  • conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  • conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  • conda config --remove channels defaults
  • conda config --set show_channel_urls yes
  • conda upgrade --all
Juyper使用Conda环境

如果你和我一样在第一次切换环境的时候遇见如下问题:

代码语言:javascript复制
Traceback (most recent call last):
  File "C:ProgramDataAnaconda3Scriptsjupyter-notebook-script.py", line 6, in <module>
    from notebook.notebookapp import main
  File "C:ProgramDataAnaconda3libsite-packagesnotebooknotebookapp.py", line 47, in <module>
    from zmq.eventloop import ioloop
  File "C:ProgramDataAnaconda3libsite-packageszmq__init__.py", line 47, in <module>
    from zmq import backend
  File "C:ProgramDataAnaconda3libsite-packageszmqbackend__init__.py", line 40, in <module>
    reraise(*exc_info)
  File "C:ProgramDataAnaconda3libsite-packageszmqutilssixcerpt.py", line 34, in reraise
    raise value
  File "C:ProgramDataAnaconda3libsite-packageszmqbackend__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "C:ProgramDataAnaconda3libsite-packageszmqbackendselect.py", line 27, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "C:ProgramDataAnaconda3libsite-packageszmqbackendcython__init__.py", line 6, in <module>
    from . import (constants, error, message, context,

解决方法:

代码语言:javascript复制
pip uninstall pyzmq 
代码语言:javascript复制
pip install pyzmq 

0 人点赞