安裝 jupyter notebook 出現 ModuleNotFoundError: No module named 'markupsafe._compat' 錯誤

  使用python

1 python -m pip install jupyter

  安裝完成 jupyter notebook 以後,在命令行界面輸入 "jupyter notebook "指令打開時,出現錯誤:ModuleNotFoundError: No module named 'markupsafe._compat'spa

 

  解決方法:在 markupsafe 文件夾下添加一個 .compat.py 文件便可:命令行

  markupsafe 文件夾在 Python 安裝路徑下:Python ->Python36 -> Lib -> site-packages -> markupsafe  ,好比個人:code

1 C:\Users\13681\AppData\Local\Programs\Python\Python36\Lib\site-packages\markupsafe

  在此文件夾下添加 .compat.py 文件,點此下載(解壓後將文件放在 markupsafe 文件夾下便可)。blog

 

附: .compat.py 文件中內容ip

 1 # -*- coding: utf-8 -*-
 2 """
 3  markupsafe._compat  4  ~~~~~~~~~~~~~~~~~~  5  Compatibility module for different Python versions.  6  :copyright: (c) 2013 by Armin Ronacher.  7  :license: BSD, see LICENSE for more details.  8 """
 9 import sys 10 PY2 = sys.version_info[0] == 2
11 if not PY2: 12     text_type = str 13     string_types = (str,) 14     unichr = chr 15     int_types = (int,) 16     iteritems = lambda x: iter(x.items()) 17 else: 18     text_type = unicode 19     string_types = (str, unicode) 20     unichr = unichr 21     int_types = (int, long) 22     iteritems = lambda x: x.iteritems()
相關文章
相關標籤/搜索