anaconda-navigator将不会以UnicodeDecodeError

时间:2018-09-25 18:08:57

标签: anaconda conda

问题描述:

重新启动后,命令$ anaconda-navigator将不再启动Anaconda Navigator。

而是生成以下跟踪堆栈:

Traceback (most recent call last):
  File "/home/penguin/anaconda3/bin/anaconda-navigator", line 11, in <module>
    sys.exit(main())
  File "/home/penguin/anaconda3/lib/python3.6/site-packages/anaconda_navigator/app/main.py", line 99, in main
    from anaconda_navigator.utils.logs import clean_logs
  File "/home/penguin/anaconda3/lib/python3.6/site-packages/anaconda_navigator/utils/logs.py", line 18, in <module>
    from anaconda_navigator.config import (LOG_FILENAME, LOG_FOLDER,
  File "/home/penguin/anaconda3/lib/python3.6/site-packages/anaconda_navigator/config/__init__.py", line 27, in <module>
    from anaconda_navigator.config.main import CONF
  File "/home/penguin/anaconda3/lib/python3.6/site-packages/anaconda_navigator/config/main.py", line 67, in <module>
    raw_mode=True,
  File "/home/penguin/anaconda3/lib/python3.6/site-packages/anaconda_navigator/config/user.py", line 221, in __init__
    self.load_from_ini()
  File "/home/penguin/anaconda3/lib/python3.6/site-packages/anaconda_navigator/config/user.py", line 279, in load_from_ini
    self.read(self.filename(), encoding='utf-8')
  File "/home/penguin/anaconda3/lib/python3.6/configparser.py", line 697, in read
    self._read(fp, filename)
  File "/home/penguin/anaconda3/lib/python3.6/configparser.py", line 1015, in _read
    for lineno, line in enumerate(fp, start=1):
  File "/home/penguin/anaconda3/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 3: invalid continuation byte

尝试进行故障排除

首先,我尝试过:

source ~/anaconda3/bin/activate root
anaconda-navigator

基于以下评论: https://github.com/ContinuumIO/anaconda-issues/issues/1580

接下来,我尝试了:

$ anaconda-navigator --reset 

但这会导致:

Anaconda Navigator配置重置...

Traceback (most recent call last):
  File "/home/penguin/anaconda3/bin/anaconda-navigator", line 11, in <module>
    sys.exit(main())
  File "/home/penguin/anaconda3/lib/python3.6/site-packages/anaconda_navigator/app/main.py", line 75, in main
    from anaconda_navigator.config import CONF_PATH
  File "/home/penguin/anaconda3/lib/python3.6/site-packages/anaconda_navigator/config/__init__.py", line 27, in <module>
    from anaconda_navigator.config.main import CONF
  File "/home/penguin/anaconda3/lib/python3.6/site-packages/anaconda_navigator/config/main.py", line 67, in <module>
    raw_mode=True,
  File "/home/penguin/anaconda3/lib/python3.6/site-packages/anaconda_navigator/config/user.py", line 221, in __init__
    self.load_from_ini()
  File "/home/penguin/anaconda3/lib/python3.6/site-packages/anaconda_navigator/config/user.py", line 279, in load_from_ini
    self.read(self.filename(), encoding='utf-8')
  File "/home/penguin/anaconda3/lib/python3.6/configparser.py", line 697, in read
    self._read(fp, filename)
  File "/home/penguin/anaconda3/lib/python3.6/configparser.py", line 1015, in _read
    for lineno, line in enumerate(fp, start=1):
  File "/home/penguin/anaconda3/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 3: invalid continuation byte

1 个答案:

答案 0 :(得分:1)

问题排查

首先,尝试重置导航器。

$ anaconda-navigator --reset

上面的命令应该删除〜/ .anaconda处的损坏的日志文件,但是如果这样做不起作用或导致错误,请尝试手动删除日志文件。

$ rm -rf /home/$USER/.anaconda

最后,如果那行不通,请尝试:

$ conda install anaconda-clean
$ conda-clean --yes

参考

@goanpeca和@jeethjoseph的评论,位于https://github.com/ContinuumIO/anaconda-issues/issues/7256