Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x cmd上的Jupyter笔记本_Python 3.x_Cmd_Jupyter Notebook - Fatal编程技术网

Python 3.x cmd上的Jupyter笔记本

Python 3.x cmd上的Jupyter笔记本,python-3.x,cmd,jupyter-notebook,Python 3.x,Cmd,Jupyter Notebook,我在尝试使用cmd运行Jupyter笔记本时遇到一些Unicode解码错误 Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\sushant>jupyter notebook [I 21:25:51.729 NotebookApp] Serving notebooks from local directory: C:\U

我在尝试使用cmd运行Jupyter笔记本时遇到一些Unicode解码错误

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\sushant>jupyter notebook
[I 21:25:51.729 NotebookApp] Serving notebooks from local directory: C:\Users\sushant
[I 21:25:51.729 NotebookApp] The Jupyter Notebook is running at:
[I 21:25:51.729 NotebookApp] http://localhost:8888/?token=c11161e89ff4d677e940f98f2613308ea70ad4772b86d3ec
[I 21:25:51.729 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Traceback (most recent call last):
  File "c:\users\sushant\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\sushant\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\sushant\AppData\Local\Programs\Python\Python37\Scripts\jupyter-notebook.EXE\__main__.py", line 9, in <module>
  File "c:\users\sushant\appdata\local\programs\python\python37\lib\site-packages\jupyter_core\application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "c:\users\sushant\appdata\local\programs\python\python37\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
    app.start()
  File "c:\users\sushant\appdata\local\programs\python\python37\lib\site-packages\notebook\notebookapp.py", line 1781, in start
    self.write_browser_open_file()
  File "c:\users\sushant\appdata\local\programs\python\python37\lib\site-packages\notebook\notebookapp.py", line 1700, in write_browser_open_file
    self._write_browser_open_file(open_url, f)
  File "c:\users\sushant\appdata\local\programs\python\python37\lib\site-packages\notebook\notebookapp.py", line 1708, in _write_browser_open_file
    template = jinja2_env.get_template('browser-open.html')
  File "c:\users\sushant\appdata\local\programs\python\python37\lib\site-packages\jinja2\environment.py", line 830, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "c:\users\sushant\appdata\local\programs\python\python37\lib\site-packages\jinja2\environment.py", line 804, in _load_template
    template = self.loader.load(self, name, globals)
  File "c:\users\sushant\appdata\local\programs\python\python37\lib\site-packages\jinja2\loaders.py", line 113, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "c:\users\sushant\appdata\local\programs\python\python37\lib\site-packages\jinja2\loaders.py", line 175, in get_source
    contents = f.read().decode(self.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9f in position 569274: invalid start byte

对。当pandas无法读取数据时,会发生该错误。我所做的是在文本编辑器中打开数据集,转换为“utf-8”并保存它。 读取数据集时,请使用:

data = pd.read_csv(<file_name>,encoding='utf-8')

这应该可以解决您的问题。

我以升华文本打开了文件,并以UTF-8编码保存,但出现了相同的错误。您能分享一下数据吗?