本文介绍了ImportError:没有名为"fabric.contrib"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Fabric 2.0.1 Errors out when running my project that calls out fabfile.py. Im on Python 3.5.1. Does anyone know why is this happening?

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'

推荐答案

在Fabric 2.0中,contrib模块不再存在.模块已被Python类取代,并且contrib模块已在这些类中分散.

In Fabric 2.0, the contrib module does not exist anymore. Modules have been replaced by Python Classes and the contrib module has been spread among those classes.

您可以在github上查看新的代码库 .

You can have a look at the new codebase on github.

这篇关于ImportError:没有名为"fabric.contrib"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 10:01