在.condarc中设置http_servers变量会产生yaml.scanner.ScannerError

时间:2015-11-01 21:10:54

标签: anaconda conda

我创建了.condarc文件设置http_servers,如上所述here,但是当我调用conda info时,它会给出以下输出:

C:\Users\[...]\AppData\Local\Continuum\Anaconda3>conda info
Traceback (most recent call last):
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\Scripts\conda-script.py", line 4, in <module>
    sys.exit(main())
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\cli\main.py", line 106, in main
    from conda.cli import conda_argparse
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 15, in <module>
    from conda.cli import common
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\cli\common.py", line 13, in <module>
    import conda.config as config
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\config.py", line 106, in <module>
    rc = load_condarc(rc_path)
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\config.py", line 104, in load_condarc
    return yaml.load(open(path)) or {}
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\yaml\__init__.py", line 72, in load
    return loader.get_single_data()
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\yaml\constructor.py", line 35, in get_single_data
    node = self.get_single_node()
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\yaml\composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\yaml\composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\yaml\composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\yaml\composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\yaml\parser.py", line 98, in check_event
    self.current_event = self.state()
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\yaml\parser.py", line 428, in parse_block_mapping_key
    if self.check_token(KeyToken):
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\yaml\scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "C:\Users\[...]\AppData\Local\Continuum\Anaconda3\lib\site-packages\yaml\scanner.py", line 257, in fetch_more_tokens
    self.get_mark())
yaml.scanner.ScannerError: while scanning for the next token
found character '\t' that cannot start any token
  in "C:\Users\[...]\.condarc", line 3, column 1

这是我的环境:

             platform : win-64
        conda version : 3.14.1
  conda-build version : 1.14.1
       python version : 3.4.3.final.0
     requests version : 2.7.0
     root environment : C:\Users\[...]\AppData\Local\Continuum\Anaconda3  (writable)
  default environment : C:\Users\[...]\AppData\Local\Continuum\Anaconda3
     envs directories : C:\Users\[...]\AppData\Local\Continuum\Anaconda3\envs
        package cache : C:\Users\[...]\AppData\Local\Continuum\Anaconda3\pkgs
         channel URLs : https://repo.continuum.io/pkgs/free/win-64/
                        https://repo.continuum.io/pkgs/free/noarch/
                        https://repo.continuum.io/pkgs/pro/win-64/
                        https://repo.continuum.io/pkgs/pro/noarch/

感谢任何评论/提示。

2 个答案:

答案 0 :(得分:9)

你的yaml文件中有一个TAB字符。用空格替换它。

答案 1 :(得分:1)

尝试type .condarccat .condarc

C:\Users\manoj>type .condarc

频道:

  • anaconda-fusion
  • 默认值

  • 默认值

编辑.condarc文件以在文本编辑器中删除最后两行并保存文件。因此.condarc文件的内容应为-

频道:

  • anaconda-fusion
  • 默认值