安装Scrapy的问题

时间:2014-07-02 18:16:44

标签: python scrapy

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

  1. Visual C ++ Redistributables(64位)
  2. Win32 Open SSL(根据上述说明将DLL复制到bin目录中)
  3. 为C:\ Python27,C:\ Python27 \ Scripts和openssl-win32 \ bin
  4. 添加了环境变量
  5. Visual C ++ Studio 2008
  6. Pywin32
  7. 的Zope
  8. LXML
  9. PyopenSSL
  10. w3lib
  11. 这是我需要使Scrapy正确运行的完整列表吗?到目前为止,当我尝试运行命令时:

    scrapy startproject myproject
    

    我在命令外壳中遇到以下错误:

    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是迄今为止我努力工作的最艰难的事情。

    由于

3 个答案:

答案 0 :(得分:1)

这是通过安装OpenSSL 64位而不是32位来解决的。一点男生的错误,但我很高兴我设法解决了根本原因!

答案 1 :(得分:0)

我通过使用安装程序从这里安装pyOpenSSL 64位来解决它:http://www.egenix.com/cryptodownload/?file=egenix-pyopenssl-0.13.0_1.0.0g_1.win-amd64-py2.7.msi

安装OpenSSL 64位无法解决我的问题。

答案 2 :(得分:0)

我刚刚在另一个帖子中回答了这个问题,但以防万一。

我刚刚设法解决了这个问题,对于那些可能偶然发现这个问题的人来说,问题是你需要PyWin32。对于Windows用户:

  1. pip install PyWin32 here,选择正确的python版本和32 / 64bit。现在在cmd中:
      

    pip install c:\ users \ desktop \ pywin32-220.1-cp27-cp27m-win_amd64.whl

  2. 现在,安装pywin32系统文件,运行&#34; python.exe Scripts \ pywin32_postinstall.py -install&#34;从提升的命令提示符。将cmd作为 admin 运行并在命令提示符下运行
      

    python&#34; C:\ Python27 \ Scripts \ pywin32_postinstall.py&#34; -install