无法从conda的新环境中启动Jupyter Notebook

时间:2020-04-16 20:54:37

标签: python jupyter-notebook conda environment

我创建了一个新环境来开发spacy相关项目。

我的代码如下:

conda create --name spcy
C:\WINDOWS\system32>conda activate spcy
conda update --all
conda install -c conda-forge spacy

我检查了我是否可以导入spacy。

(spcy) C:\WINDOWS\system32>python
Python 3.6.10 (default, Mar  5 2020, 10:17:47) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import spacy
>>> quit()

(spcy) C:\WINDOWS\system32>conda install ipykernel
(spcy) C:\WINDOWS\system32>ipython kernel install --name spcy --user
Installed kernelspec spcy in C:\Users\Alienware\AppData\Roaming\jupyter\kernels\spcy

但是当我尝试启动jupyter笔记本时,会发生错误:

(spcy) C:\WINDOWS\system32>jupyter notebook
Traceback (most recent call last):
  File "C:\Users\Alienware\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 9, in <module>
    import sqlite3
  File "C:\Users\Alienware\Anaconda3\lib\sqlite3\__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "C:\Users\Alienware\Anaconda3\lib\sqlite3\dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Alienware\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
    from notebook.notebookapp import main
  File "C:\Users\Alienware\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 83, in <module>
    from .services.sessions.sessionmanager import SessionManager
  File "C:\Users\Alienware\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 12, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'

当我尝试安装pysqlite2时,出现了新错误:

(spcy) C:\WINDOWS\system32>pip install pysqlite
Collecting pysqlite
  Downloading pysqlite-2.8.3.tar.gz (80 kB)
     |████████████████████████████████| 80 kB 193 kB/s
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\Alienware\Anaconda3\envs\spcy\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Alienware\\AppData\\Local\\Temp\\pip-install-bry2jvcn\\pysqlite\\setup.py'"'"'; __file__='"'"'C:\\Users\\Alienware\\AppData\\Local\\Temp\\pip-install-bry2jvcn\\pysqlite\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Alienware\AppData\Local\Temp\pip-install-bry2jvcn\pysqlite\pip-egg-info'
         cwd: C:\Users\Alienware\AppData\Local\Temp\pip-install-bry2jvcn\pysqlite\
    Complete output (1 lines):
    pysqlite is not supported on Python 3. When using Python 3, use the sqlite3 module from the standard library.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我应该怎么做才能启动Jupyter Notebook并在spcy环境中工作?

0 个答案:

没有答案