我今天尝试安装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
任何帮助不胜感激!
安装 google.colab -> 删除虚拟环境然后再次创建虚拟环境后,我在虚拟环境中遇到了同样的问题。以下方法解决了该问题:
pip3 uninstall notebook
pip3 install --ignore-installed --no-cache-dir --upgrade notebook