Windows环境下Anaconda启动Jupyter报错:UnicodeError

环境

windows 7
anaconda3 5.x版本
Jupyter 6.0.3

过程

打开anaconda,在anaconda图形界面中打开jupyter,报错提示:UnicodeError xxxx.py 186lines xxxx

文件路径大概是(8-9点左右出错解决,凌晨下想起来写这篇文章):path/anaconda\Lib\site-packages\jinja2\loaders.py

在186行中修改所提示py源文件。

原本应该是:contents = f.read().decode(self.encoding)

修改之后如下:

    def get_source(self, environment, template):
        pieces = split_template_path(template)
        for searchpath in self.searchpath:
            filename = path.join(searchpath, *pieces)
            f = open_if_exists(filename)
            if f is None:
                continue
            try:
                contents = f.read().decode(self.encoding,"ignore")
            finally:
                f.close()

            mtime = path.getmtime(filename)

            def uptodate():
                try:
                    return path.getmtime(filename) == mtime
                except OSError:
                    return False

            return contents, filename, uptodate
        raise TemplateNotFound(template)

重启anaconda之后(不重启也是可以的),启动jupyter成功!

你可能感兴趣的:(小问题随笔,anaconda,jupyter)