失败:ImportError(没有名为'bunch'的模块)

时间:2018-06-13 13:07:35

标签: python python-3.4 nose

我正在尝试使用以下命令运行一些python测试:

nosetests -e --process-timeout=1200 mytests.functional.test_1234

当我这样做时,我收到此错误:

======================================================================
ERROR: Failure: ImportError (No module named 'bunch')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/me/Downloads/nose-1.3.7/build/lib/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/Users/me/Downloads/nose-1.3.7/build/lib/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/Users/me/Downloads/nose-1.3.7/build/lib/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Users/me/Downloads/nose-1.3.7/build/lib/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 245, in load_module
    return load_package(name, filename)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 217, in load_package
    return methods.load()
  File "<frozen importlib._bootstrap>", line 1220, in load
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/Users/me/git/python-test/mytests/functional/__init__.py", line 12, in <module>
    import bunch
ImportError: No module named 'bunch'

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)

我尝试了sudo pip install bunch,但得到了这个:

Collecting bunch
  Could not fetch URL https://pypi.python.org/simple/bunch/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:600) - skipping

接下来我试图通过PyCharm安装一堆似乎已经成功但是当我运行pip show bunch时,没有返回任何内容。

有人能说出我做错了吗?

1 个答案:

答案 0 :(得分:0)

我想你可以在pip install上添加pypi.python.org作为可信主机。尝试:

sudo pip install --trusted-host pypi.python.org bunch