ImportError: dynamic module does not define init function (init_openssl)

jike_1783833 定向爬虫:Scrapy 初探 最后由 jike_1783833 于2017年02月05日回复

  • 1 回答
  • 1.7k 浏览

老师您好,我是mac,装了python2.7,按照您第二课中的代码,运行提示错误,提示ImportError: dynamic module does not define init function (init_openssl)。在网上找的各种解决方案总是不成功,请问有什么解决方案?

以下是提示的代码:

/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/Jeremy/python/doubantest/doubantest/main.py

Traceback (most recent call last):

  File "/Users/Jeremy/python/doubantest/doubantest/main.py", line 2, in <module>

    cmdline.execute("scrapy crawl doubanTest".split())

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scrapy/cmdline.py", line 121, in execute

    cmds = _get_commands_dict(settings, inproject)

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scrapy/cmdline.py", line 45, in _get_commands_dict

    cmds = _get_commands_from_module('scrapy.commands', inproject)

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scrapy/cmdline.py", line 28, in _get_commands_from_module

    for cmd in _iter_command_classes(module):

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scrapy/cmdline.py", line 19, in _iter_command_classes

    for module in walk_modules(module_name):

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scrapy/utils/misc.py", line 71, in walk_modules

    submod = import_module(fullpath)

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module

    __import__(name)

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scrapy/commands/version.py", line 6, in <module>

    import OpenSSL

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>

    from OpenSSL import rand, crypto, SSL

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/rand.py", line 12, in <module>

    from OpenSSL._util import (

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>

    from cryptography.hazmat.bindings.openssl.binding import Binding

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>

    from cryptography.hazmat.bindings._openssl import ffi, lib

ImportError: dynamic module does not define init function (init_openssl)

  • jike_1783833 2017年02月05日 回答 #1楼
  • 问题已经解决,是之前用pygame编程将python设置成32bit的版本,调回成64bit的之后问题就解决了。

  • 0 评论