我今天尝试安装pip install google-colab
,但由于某种原因而失败。从那时起,什么都没有了。当我在Python 3内核上运行代码时,它永远不会执行(重新启动内核无济于事)。在venv内核上运行它时,我可以执行代码,不需要任何模块,例如print("hi")
。但是,当我导入模块时,出现以下错误:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/opt/anaconda3/envs/torch/lib/python3.8/codeop.py in __call__(self, source, filename, symbol)
134
135 def __call__(self, source, filename, symbol):
--> 136 codeob = compile(source, filename, symbol, self.flags, 1)
137 for feature in _features:
138 if codeob.co_flags & feature.compiler_flag:
TypeError: required field "type_ignores" missing from Module
感谢您的帮助!
答案 0 :(得分:2)
在安装google.colab->删除虚拟环境后,我又在虚拟环境中遇到了相同的问题,然后再次创建了虚拟环境。以下解决了该问题:
pip uninstall notebook
pip3 install --ignore-installed --no-cache-dir --upgrade notebook