Skip to main content
 首页 » 编程设计

python之安装 Scrapy 的问题

2025年05月04日15linjiqin

我已经(据我所知)正确安装了 Scrapy 的所有依赖项。我在 Windows Vista 64 位上运行 Python 的 64 位版本 Scrapy.org。到目前为止我已经安装了:

  1. Visual C++ 可再发行组件(64 位)
  2. Win32 Open SSL(将 DLL 复制到 bin 目录 - 按照上述说明)
  3. 为 C:\Python27、C:\Python27\Scripts 和 openssl-win32\bin 添加了环境变量
  4. Visual C++ Studio 2008
  5. Pywin32
  6. 佐普
  7. 扭曲
  8. lxml
  9. PyopenSSL
  10. w3lib

这是使 Scrapy 正确运行所需的完整列表吗?到目前为止,当我尝试运行命令时:

scrapy startproject myproject 

我在 Command Shell 中收到以下错误:

Microsoft Windows [Version 6.0.6002] 
Copyright (c) 2006 Microsoft Corporation.  All rights reserved. 
 
C:\Users\Oleg Salenko>scrapy startproject mrscrap 
Traceback (most recent call last): 
  File "c:\Python27\Scripts\scrapy", line 3, in <module> 
    from scrapy.cmdline import execute 
  File "c:\Python27\lib\site-packages\scrapy\cmdline.py", line 9, in <module> 
    from scrapy.crawler import CrawlerProcess 
  File "c:\Python27\lib\site-packages\scrapy\crawler.py", line 3, in <module> 
    from twisted.internet import reactor, defer 
  File "c:\Python27\lib\site-packages\twisted\internet\reactor.py", line 38, in 
<module> 
    from twisted.internet import default 
  File "c:\Python27\lib\site-packages\twisted\internet\default.py", line 56, in 
<module> 
    install = _getInstallFunction(platform) 
  File "c:\Python27\lib\site-packages\twisted\internet\default.py", line 50, in 
_getInstallFunction 
    from twisted.internet.selectreactor import install 
  File "c:\Python27\lib\site-packages\twisted\internet\selectreactor.py", line 1 
8, in <module> 
    from twisted.internet import posixbase 
  File "c:\Python27\lib\site-packages\twisted\internet\posixbase.py", line 24, i 
n <module> 
    from twisted.internet import error, udp, tcp 
  File "c:\Python27\lib\site-packages\twisted\internet\tcp.py", line 29, in <mod 
ule> 
    from twisted.internet._newtls import ( 
  File "c:\Python27\lib\site-packages\twisted\internet\_newtls.py", line 21, in 
<module> 
    from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol 
  File "c:\Python27\lib\site-packages\twisted\protocols\tls.py", line 41, in <mo 
dule> 
    from OpenSSL.SSL import Error, ZeroReturnError, WantReadError 
  File "c:\Python27\lib\site-packages\OpenSSL\__init__.py", line 8, in <module> 
    from OpenSSL import rand, crypto, SSL 
  File "c:\Python27\lib\site-packages\OpenSSL\rand.py", line 11, in <module> 
    from OpenSSL._util import ( 
  File "c:\Python27\lib\site-packages\OpenSSL\_util.py", line 4, in <module> 
    binding = Binding() 
  File "c:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\bindi 
ng.py", line 87, in __init__ 
    self._ensure_ffi_initialized() 
  File "c:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\bindi 
ng.py", line 106, in _ensure_ffi_initialized 
    libraries=libraries, 
  File "c:\Python27\lib\site-packages\cryptography\hazmat\bindings\utils.py", li 
ne 80, in build_ffi 
    extra_link_args=extra_link_args, 
  File "c:\Python27\lib\site-packages\cffi\api.py", line 341, in verify 
    lib = self.verifier.load_library() 
  File "c:\Python27\lib\site-packages\cffi\verifier.py", line 75, in load_librar 
y 
    return self._load_library() 
  File "c:\Python27\lib\site-packages\cffi\verifier.py", line 151, in _load_libr 
ary 
    return self._vengine.load_library() 
  File "c:\Python27\lib\site-packages\cffi\vengine_cpy.py", line 138, in load_li 
brary 
    raise ffiplatform.VerificationError(error) 
cffi.ffiplatform.VerificationError: importing 'c:\\Python27\\lib\\site-packages\ 
\cryptography\\_Cryptography_cffi_444d7397xa22f8491.pyd': DLL load failed: %1 is 
 not a valid Win32 application. 
 
C:\Users\Oleg Salenko> 

谁能看出是什么导致了这些错误?我是 Python 的新手,Scrapy 是迄今为止我尝试过的最难上手的东西。

谢谢

请您参考如下方法:

通过安装 OpenSSL 64 位而不是 32 位解决了这个问题。有点小学生的错误,但我很高兴我设法找出了根本原因!