python2.7.5 安装scrapy遇到问题,file libcrypto.so.1.0.0 。。



 ~/g/f2$ pip list
argparse (1.2.1)
cffi (0.8.6)
cryptography (0.7.1)
cssselect (0.9.1)
enum34 (1.0.4)
lxml (3.4.1)
pip (1.4.1)
pyasn1 (0.1.7)
pycparser (2.10)
pyOpenSSL (0.14)
queuelib (1.2.2)
Scrapy (0.24.4)
setuptools (0.9.8)
six (1.9.0)
Twisted (14.0.2)
w3lib (1.11.0)
wsgiref (0.1.2)
zope.interface (4.1.2)
(f2)hawk@hawk:~/g/f2$ python --version
Python 2.7.5+
(f2)hawk@hawk:~/g/f2$ scrapy  startproject tutorial
Traceback (most recent call last):
  File "/home/hawk/g/f2/bin/scrapy", line 9, in <module>
    load_entry_point('Scrapy==0.24.4', 'console_scripts', 'scrapy')()
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
    return ep.load()
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/scrapy/cmdline.py", line 9, in <module>
    from scrapy.crawler import CrawlerProcess
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/scrapy/crawler.py", line 3, in <module>
    from twisted.internet import reactor, defer
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/twisted/internet/reactor.py", line 38, in <module>
    from twisted.internet import default
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/twisted/internet/default.py", line 56, in <module>
    install = _getInstallFunction(platform)
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/twisted/internet/default.py", line 44, in _getInstallFunction
    from twisted.internet.epollreactor import install
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/twisted/internet/epollreactor.py", line 24, in <module>
    from twisted.internet import posixbase
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 24, in <module>
    from twisted.internet import error, udp, tcp
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/twisted/internet/tcp.py", line 29, in <module>
    from twisted.internet._newtls import (
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/twisted/internet/_newtls.py", line 21, in <module>
    from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/twisted/protocols/tls.py", line 41, in <module>
    from OpenSSL.SSL import Error, ZeroReturnError, WantReadError
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/OpenSSL/rand.py", line 11, in <module>
    from OpenSSL._util import (
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/OpenSSL/_util.py", line 4, in <module>
    binding = Binding()
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 113, in __init__
    self._ensure_ffi_initialized()
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 123, in _ensure_ffi_initialized
    cls._modules,
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/cryptography/hazmat/bindings/utils.py", line 31, in load_library_for_binding
    lib = ffi.verifier.load_library()
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/cffi/verifier.py", line 75, in load_library
    return self._load_library()
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/cffi/verifier.py", line 151, in _load_library
    return self._vengine.load_library()
  File "/home/hawk/g/f2/local/lib/python2.7/site-packages/cffi/vengine_cpy.py", line 149, in load_library
    raise ffiplatform.VerificationError(error)
cffi.ffiplatform.VerificationError: importing '/home/hawk/g/f2/local/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_70441dc9x8be47966.so': /home/hawk/g/f2/local/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_70441dc9x8be47966.so: symbol EC_GFp_nistp521_method, version OPENSSL_1.0.1 not defined in file libcrypto.so.1.0.0 with link time reference


 cffi.ffiplatform.VerificationError: importing '/home/hawk/g/f2/local/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_70441dc9x8be47966.so': /home/hawk/g/f2/local/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_70441dc9x8be47966.so: symbol EC_GFp_nistp521_method, version OPENSSL_1.0.1 not defined in file libcrypto.so.1.0.0 with link time reference

想知道有人遇到这种问题吗,怎么解决的?

以为没有安装libssl-dev,检查了一下,都安装好了

图片描述
图片描述
图片描述

scrapy python2.7

南瓜酱XD 9 years, 9 months ago

解决问题

1.删除 pyOpenSSL0.14 (这是默认安装版本)
2.安装pyOpenSSL0.13


 pip install pyOpenSSL==0.13

或者 安装Scrapy的时候,先安装pyOpenSSL0.13,直接安装scrapy就可以了。

夏日丨葱娘 answered 9 years, 9 months ago

可能是因为没有安装 openssl

UBuntu

sudo apt-get install openssl libssl-dev

MacOS


 brew update
brew install openssl
brew link --force openssl

景衣卫D阿牙酱 answered 9 years, 9 months ago

你的 Python 库 cryptography 或者 OpenSSL 似乎是使用的二进制文件,而不是在本地自己编译的。然后,你的 openssl 版本(1.0.0)和需要的(1.0.1)不匹配。

你可以看看你的发行版有没有打包 scrapy。如果有的话直接安装就可以了。比如 Debian 用户可以直接安装「python-scrapy」这个包。Ubuntu 也可以找找看。

Tantra answered 9 years, 9 months ago

确认libcrypto已经安装
确认libcrypto.so.1.0.0存在,可以通过locate命令查找
确认libcrypto.so.1.0.0在setup.py的搜索路径,比如/lib目录

笨笨:皇子 answered 9 years, 9 months ago

Your Answer