ImportError:没有名为' fabric.contrib'

时间:2018-05-18 20:04:49

标签: python python-3.5 importerror fabric

Fabric 2.0.1运行调用fabfile.py的项目时出错。我在Python 3.5.1上。有谁知道为什么会这样?

Traceback (most recent call last):
  File ".bootstrap/_pex/pex.py", line 367, in execute
  File ".bootstrap/_pex/pex.py", line 293, in _wrap_coverage
  File ".bootstrap/_pex/pex.py", line 325, in _wrap_profiling
  File ".bootstrap/_pex/pex.py", line 410, in _execute
  File ".bootstrap/_pex/pex.py", line 468, in execute_entry
  File ".bootstrap/_pex/pex.py", line 486, in execute_pkg_resources
  File "/root/.pex/install/invoke-1.0.0-py3-none-any.whl.a7f464a6969cebbbd25df555b795379694067bba/invoke-1.0.0-py3-none-any.whl/invoke/program.py", line 321, in run
    self.parse_collection()
  File "/root/.pex/install/invoke-1.0.0-py3-none-any.whl.a7f464a6969cebbbd25df555b795379694067bba/invoke-1.0.0-py3-none-any.whl/invoke/program.py", line 399, in parse_collection
    self.load_collection()
  File "/root/.pex/install/fabric-2.0.1-py2.py3-none-any.whl.ae5e123ea5423bf8dce5f39ab3d9b0b8eb7b8e39/fabric-2.0.1-py2.py3-none-any.whl/fabric/main.py", line 74, in load_collection
    super(Fab, self).load_collection()
  File "/root/.pex/install/invoke-1.0.0-py3-none-any.whl.a7f464a6969cebbbd25df555b795379694067bba/invoke-1.0.0-py3-none-any.whl/invoke/program.py", line 588, in load_collection
    module, parent = loader.load(coll_name)
  File "/root/.pex/install/invoke-1.0.0-py3-none-any.whl.a7f464a6969cebbbd25df555b795379694067bba/invoke-1.0.0-py3-none-any.whl/invoke/loader.py", line 75, in load
    module = imp.load_module(name, fd, path, desc)
  File "/usr/local/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/local/lib/python3.5/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 662, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/etc/appliance/fabric/fabfile.py", line 1, in <module>
    from fabric.contrib import *
ImportError: No module named 'fabric.contrib'

1 个答案:

答案 0 :(得分:2)

在Fabric 2.0中,contrib模块不再存在。模块已被Python类替换,contrib模块已在这些类中传播。

您可以查看新的代码库on github