尝试使用conda时出现“ SyntaxError:生成器表达式必须加括号”

时间:2019-07-23 07:42:18

标签: python syntax-error conda

每当我尝试访问任何anaconda命令时,我都会遇到此问题。实际上,当我尝试打开虚拟环境时,它也在其中显示

我重新安装了Anaconda导航器,但仍然没有结果

C:\Users\Gagan Singh>activate tensorflow1
Traceback (most recent call last):
  File "c:\users\gagan singh\appdata\local\programs\python\python37\lib\site-packages\conda\common\configuration.py", line 30, in <module>
    from cytoolz.dicttoolz import merge
ModuleNotFoundError: No module named 'cytoolz'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\gagan singh\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\gagan singh\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Gagan Singh\AppData\Local\Programs\Python\Python37\Scripts\conda.exe\__main__.py", line 5, in <module>
  File "c:\users\gagan singh\appdata\local\programs\python\python37\lib\site-packages\conda\cli\__init__.py", line 8, in <module>
    from .main import main  # NOQA
  File "c:\users\gagan singh\appdata\local\programs\python\python37\lib\site-packages\conda\cli\main.py", line 46, in <module>
    from ..base.context import context
  File "c:\users\gagan singh\appdata\local\programs\python\python37\lib\site-packages\conda\base\context.py", line 18, in <module>
    from ..common.configuration import (Configuration, MapParameter, PrimitiveParameter,
  File "c:\users\gagan singh\appdata\local\programs\python\python37\lib\site-packages\conda\common\configuration.py", line 35, in <module>
    from .._vendor.toolz.functoolz import excepts
  File "c:\users\gagan singh\appdata\local\programs\python\python37\lib\site-packages\conda\_vendor\toolz\functoolz.py", line 467
    f.__name__ for f in reversed((self.first,) + self.funcs),
    ^
SyntaxError: Generator expression must be parenthesized

1 个答案:

答案 0 :(得分:0)

就我而言,pip3 uninstall conda 解决了问题。

原因是 miniconda 试图使用 pip 的可执行文件。当我先使用 conda 然后使用 miniconda 安装 pip3 时发生了这种情况。