使用
1 python -m pip install jupyter
安装完成 jupyter notebook 之后,在命令行界面输入 "jupyter notebook "指令打开时,出现错误:ModuleNotFoundError: No module named ‘markupsafe._compat‘
解决方法:在 markupsafe 文件夹下添加一个 .compat.py 文件即可:
markupsafe 文件夹在 Python 安装路径下:Python ->Python36 -> Lib -> site-packages -> markupsafe ,比如我的:
1 C:\Users\13681\AppData\Local\Programs\Python\Python36\Lib\site-packages\markupsafe
在此文件夹下添加 .compat.py 文件,点此下载(解压后将文件放在 markupsafe 文件夹下即可)。
附: .compat.py 文件中内容
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()
安装 jupyter notebook 出现 ModuleNotFoundError: No module named 'markupsafe._compat' 错误
原文地址:https://www.cnblogs.com/pgzhang/p/9146121.html
时间: 2024-10-03 21:53:34