0
>>>import scrapy
 Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\SoftWare\Python27\lib\site-packages\scrapy\__init__.py", line 56, in
<module>
    from scrapy.spider import Spider
  File "D:\SoftWare\Python27\lib\site-packages\scrapy\spider.py", line 7, in <mo
dule>
    from scrapy.http import Request
  File "D:\SoftWare\Python27\lib\site-packages\scrapy\http\__init__.py", line 11
, in <module>
    from scrapy.http.request.form import FormRequest
  File "D:\SoftWare\Python27\lib\site-packages\scrapy\http\request\form.py", lin
e 9, in <module>
    import lxml.html
  File "D:\SoftWare\Python27\lib\site-packages\lxml\html\__init__.py", line 42,
in <module>
    from lxml import etree
ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。

This is what I had installed :pip list

aniso8601 (1.0.0)
cffi (1.2.1)
characteristic (14.3.0)
cryptography (1.0.1)
cssselect (0.9.1)
enum34 (1.0.4)
field (0.2.0)
Flask (0.10.1)
Flask-RESTful (0.3.4)
Flask-Script (2.0.5)
Flask-SQLAlchemy (2.0)
idna (2.0)
ipaddress (1.0.14)
item (0.0.3)
itsdangerous (0.24)
Jinja2 (2.8)
libxml2-python (2.7.7)
lxml (3.4.4)
MarkupSafe (0.23)
mysql-connector-python (2.0.4)
MySQL-python (1.2.5)
PIL (1.1.7)
Pillow (2.9.0)
pip (7.1.2)
pyasn1 (0.1.8)
pyasn1-modules (0.0.7)
pycparser (2.14)
pyOpenSSL (0.15.1)
pytils (0.3)
pytz (2015.4)
pywin32 (219)
queuelib (1.4.2)
requests (2.7.0)
Scrapy (1.0.3)
selection (0.0.11)
service-identity (14.0.0)
setuptools (18.3.2)
six (1.9.0)
SQLAlchemy (1.0.8)
Twisted (15.4.0)
w3lib (1.12.0)
weblib (0.1.15)
Werkzeug (0.10.4)
WTForms (2.0.2)
zope.interface (4.1.2)

My system is WIN7 x64 , Python 2.7.10 win32 I think I had already installed what Scrapy require but I can`t run it. I had tried to install 0.24.2 (lower version) but the problem can not be sloved

wyx
  • 3,334
  • 6
  • 24
  • 44
  • Can you translate the error message `DLL load failed: %1 不是有效的 Win32 应用程序。` into English for us? – BrokenBinary Sep 21 '15 at 17:59
  • You can get Sysinternals tools from Microsoft and use Process Monitor to log all Python's activity to get an insight on what is happening when that library is loaded. – Anton Samsonov Sep 21 '15 at 18:30
  • possible duplicate of [ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there](http://stackoverflow.com/questions/19019720/importerror-dll-load-failed-1-is-not-a-valid-win32-application-but-the-dlls) – Andrés Pérez-Albela H. Sep 22 '15 at 01:48
  • Sorry ,`DLL load failed: %1 不是有效的 Win32 应用程序。` means **ImportError: DLL load failed: %1 is not a valid Win32 application.** – wyx Sep 22 '15 at 06:17

1 Answers1

1

The solution is that you need some other requirements to install when using Scrapy on Windows because of a Bug of Twisted. You can read more about it in the docs.

If you go through all the steps you will see that you need to install pywin32 too. Alternatively you can look at the installation instructions here because it is sometimes a bit more complicated. I used this doc for Windows and it works.

GHajba
  • 3,665
  • 5
  • 25
  • 35
  • when I install pywin32 32-bit follow your suggestion,`Traceback (most recent call last): File "", line 408, in install File "", line 221, in RegisterPythonwin WindowsError: [Error 5] close failed in file object destructor: sys.excepthook is missing lost sys.stderr` **how to solve it Can you help me** Other requirements like openSSL , Twisted ,zope.interface.....I have installed. – wyx Sep 23 '15 at 01:24
  • Did you install it with the manual from here: http://www.feedbackward.com/content/scrapy_install.pdf ? – GHajba Sep 23 '15 at 05:33