我在运行使用“导入枚举”的 Python 文件时遇到问题,给了我这个问题:
Traceback (most recent call last):
File "lowest_common_ancestor.py", line 4, in <module>
from test_framework import generic_test, test_utils
File "/Users/linh/Documents/EPIJudge/epi_judge_python/test_framework/generic_test.py", line 6, in <module>
from test_framework.generic_test_handler import GenericTestHandler
File "/Users/linh/Documents/EPIJudge/epi_judge_python/test_framework/generic_test_handler.py", line 5, in <module>
from test_framework.binary_tree_utils import assert_equal_binary_trees, is_object_tree_type
File "/Users/linh/Documents/EPIJudge/epi_judge_python/test_framework/binary_tree_utils.py", line 5, in <module>
from test_framework.test_failure import TestFailure, PropertyName
File "/Users/linh/Documents/EPIJudge/epi_judge_python/test_framework/test_failure.py", line 2, in <module>
from enum import Enum, auto
ImportError: cannot import name 'auto'
我知道我有 Python 2.7 并且“导入枚举”只存在于 Python 3 中,但是我在如何创建两个不同的环境时遇到了麻烦,我同时拥有 Python 2.7 和 Python 3。如何在 Mac Unix 上执行此操作终端,我也不是很熟悉。