Python 刮片错误--导入错误:未加载库

Python 刮片错误--导入错误:未加载库,python,macos,openssl,scrapy,osx-snow-leopard,Python,Macos,Openssl,Scrapy,Osx Snow Leopard,我正试图用Scrapy做我的第一部分工作,使用的是来自的一个非常简单的演示,我得到一个ImportError:库未加载,如下所示 gchrist1$ scrapy crawl dmoz 2015-12-20 17:48:33 [scrapy] INFO: Scrapy 1.0.3 started (bot: scrapybot) 2015-12-20 17:48:33 [scrapy] INFO: Optional features available: ssl, http11, boto

我正试图用Scrapy做我的第一部分工作,使用的是来自的一个非常简单的演示,我得到一个ImportError:库未加载,如下所示

gchrist1$ scrapy crawl dmoz

2015-12-20 17:48:33 [scrapy] INFO: Scrapy 1.0.3 started (bot: scrapybot)

2015-12-20 17:48:33 [scrapy] INFO: Optional features available: ssl, http11, boto

2015-12-20 17:48:33 [scrapy] INFO: Overridden settings: {'DEFAULT_ITEM_CLASS': 'dirbot.items.Website', 'NEWSPIDER_MODULE': 'dirbot.spiders', 'SPIDER_MODULES': ['dirbot.spiders']}

Traceback (most recent call last):

File "/Users/gchrist1/anaconda/bin/scrapy", line 11, in <module>
sys.exit(execute())

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/scrapy/cmdline.py", line 143, in execute
_run_print_help(parser, _run_command, cmd, args, opts)

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/scrapy/cmdline.py", line 89, in _run_print_help
func(*a, **kw)

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/scrapy/cmdline.py", line 150, in _run_command
cmd.run(args, opts)

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/scrapy/commands/crawl.py", line 57, in run
self.crawler_process.crawl(spname, **opts.spargs)

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/scrapy/crawler.py", line 150, in crawl
crawler = self._create_crawler(crawler_or_spidercls)

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/scrapy/crawler.py", line 166, in _create_crawler
return Crawler(spidercls, self.settings)

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/scrapy/crawler.py", line 46, in __init__
self.extensions = ExtensionManager.from_crawler(self)

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/scrapy/middleware.py", line 56, in from_crawler
return cls.from_settings(crawler.settings, crawler)

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/scrapy/middleware.py", line 32, in from_settings
mwcls = load_object(clspath)

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/scrapy/utils/misc.py", line 44, in load_object
mod = import_module(module)

File "/Users/gchrist1/anaconda/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/scrapy/extensions/memusage.py", line 16, in <module>
from scrapy.mail import MailSender

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/scrapy/mail.py", line 22, in <module>
from twisted.internet import defer, reactor, ssl

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/twisted/internet/ssl.py", line 59, in <module>
from OpenSSL import SSL

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding

File "/Users/gchrist1/anaconda/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 13, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib

ImportError: dlopen(/Users/gchrist1/anaconda/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so, 2): Library not loaded: libcrypto.1.0.0.dylib

Referenced from: /Users/gchrist1/anaconda/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so

Reason: image not found
但后者没有:

pip install OpenSSL
Downloading/unpacking OpenSSL
  Could not find any downloads that satisfy the requirement OpenSSL
Cleaning up...
No distributions at all found for OpenSSL
Storing debug log for failure in /Users/gchrist1/.pip/pip.log)
但我还是犯了同样的错误。我还尝试了在 但也犯了同样的错误

导入错误:dlopen(/Users/gchrist1/anaconda/lib/python2.7/site-packages/cryptography/hazmat/bindings//u openssl.so,2):未加载库:libcrypto.1.0.0.dylib

在OSX上,Python和Scrapy等各种包可能都应该使用一个新的库,以便在运行时找到库的正确版本。听起来好像他们在构建/安装期间没有使用它

对libcrypto.1.0.0.dylib执行查找:

find <some directory> -name libcrypto.1.0.0.dylib
find-name libcrypto.1.0.0.dylib

获得路径后,在运行其他程序之前,使用设置路径
DYLD\u LIBRARY\u PATH
类似于Linux。另请参阅苹果的手册页。

也许您应该尝试升级
pip
,然后重新开始:

easy_install -U pip
easy_install -U pip