我正在尝试使用亚利桑那州库上CentOS Linux release 7.6.1810 (Core)
,但是当我运行时az --version
显示以下消息。
[azure@cdh-raw-master ~]$ az --version
Traceback (most recent call last):
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/usr/lib64/az/lib/python2.7/site-packages/azure/__init__.py", line 1, in <module>
__import__('pkg_resources').declare_namespace(__name__)
File "/usr/lib64/az/lib/python2.7/site-packages/pkg_resources/__init__.py", line 24, in <module>
import re
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
我尝试使用 Python 2 和 3,但遇到了同样的问题。我az
使用以下命令进行安装:
sudo sh -c 'echo -e "[azure-cli]\nname=AzureCLI\nbaseurl=https://packages.microsoft.com/yumrepos/azure-cli\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azure-cli.repo'
sudo yum install azure-cli
我使用以下命令安装了 python3:
sudo yum install rh-python36
答案1
我遇到了同样的问题,我从 2.0.70 降级到 2.0.64
sudo yum downgrade azure-cli-2.0.64