““ AttributeError:模块'enum'没有属性'IntFlag''仅在Jupyter笔记本python 3.6.7内核中?

时间:2018-10-30 02:34:53

标签: python jupyter-notebook

我正在尝试使用python 3.6.7内核启动Jupyter笔记本。我正在使用安装了软件包的conda环境。当我从命令行使用python时,它显示了python 3.6.7,并且没有错误。当我尝试打开笔记本并使用python 3内核时,得到以下信息:

[I 11:04:47.372 NotebookApp] KernelRestarter: restarting kernel (2/5)
Failed to import the site module
Traceback (most recent call last):
  File "/anaconda3/envs/cacheopt/lib/python3.6/site.py", line 550, in <module>
main()
  File "/anaconda3/envs/cacheopt/lib/python3.6/site.py", line 531, in main
known_paths = addusersitepackages(known_paths)
  File "/anaconda3/envs/cacheopt/lib/python3.6/site.py", line 282, in addusersitepackages
user_site = getusersitepackages()
  File "/anaconda3/envs/cacheopt/lib/python3.6/site.py", line 258, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
  File "/anaconda3/envs/cacheopt/lib/python3.6/site.py", line 248, in getuserbase
USER_BASE = get_config_var('userbase')
  File "/anaconda3/envs/cacheopt/lib/python3.6/sysconfig.py", line 609, in get_config_var
return get_config_vars().get(name)
  File "/anaconda3/envs/cacheopt/lib/python3.6/sysconfig.py", line 588, in get_config_vars
import _osx_support
  File "/anaconda3/envs/cacheopt/lib/python3.6/_osx_support.py", line 4, in <module>
import re
  File "/anaconda3/envs/cacheopt/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

当我切换为使用python2内核时没有错误。 我尝试了this post中列出的内容,但无济于事。

创建python3 conda环境后,我运行了以下命令:

python -m ipykernel install --user --name=myenv

感到困惑,因为在命令行上一切正常,我只在笔记本电脑上收到此错误。

0 个答案:

没有答案