Skip to main content
 首页 » 编程设计

python之织物导入错误 : cannot import name 'isMappingType' with Python 2. 7

2025年04月02日34shanyou

我正在尝试在本地启动和运行 Fab。为什么 Fab 安装到 /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5?系统Python版本为2.7.10,确认如下:

Toms-MBP:~ tom$ which python 
/usr/local/bin/python 
Toms-MBP:~ tom$ python --version 
Python 2.7.10 
Toms-MBP:~ tom$ head -1 `which fab` 
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 
Toms-MBP:~ tom$ fab 
Traceback (most recent call last): 
  File "/Library/Frameworks/Python.framework/Versions/3.5/bin/fab", line 9, in <module> 
    load_entry_point('Fabric==1.11.1', 'console_scripts', 'fab')() 
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 558, in load_entry_point 
    return get_distribution(dist).load_entry_point(group, name) 
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2682, in load_entry_point 
    return ep.load() 
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2355, in load 
    return self.resolve() 
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2361, in resolve 
    module = __import__(self.module_name, fromlist=['__name__'], level=0) 
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/fabric/main.py", line 13, in <module> 
    from operator import isMappingType 
ImportError: cannot import name 'isMappingType' 

请您参考如下方法:

你需要这个:

pip install fabric3