1. 安装pywin32
旧地址 https://github.com/mhammond/pywin32/releases
新的下载地址 https://github.com/mhammond/pywin32/releases
根据自己安装的Python版本选择pywin32的版本
2.安装lxml
pip install lxml
3.安装twisted
下载地址https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
下载Twisted‑17.9.0‑cp36‑cp36m‑win_amd64.whl
进入所在文件夹,
pip install Twisted-17.9.0-cp36-cp36m-win_amd64.whl
4.pip install Scrapy
(我还没安装OpenSSL,但是
)
报错:
Installingcollected packages: queuelib, PyDispatcher, cssselect, pycparser, cffi,asn1crypto, cryptography, pyOpenSSL, pyasn1, pyasn1-modules, service-identity,w3lib, parsel, Scrapy
Running setup.py install for PyDispatcher ...error
Exception:
Traceback(most recent call last):
File "c:\users\嘿\appdata\local\programs\python\python36\lib\site-packages\pip\compat\__init__.py",line 73, in console_to_str
return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError:'utf-8' codec can't decode byte 0xba in position 18: invalid start byte
Duringhandling of the above exception, another exception occurred:
Traceback(most recent call last):
File "c:\users\嘿\appdata\local\programs\python\python36\lib\site-packages\pip\basecommand.py",line 215, in main
status = self.run(options, args)
File "c:\users\嘿\appdata\local\programs\python\python36\lib\site-packages\pip\commands\install.py",line 342, in run
prefix=options.prefix_path,
File "c:\users\嘿\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py",line 784, in install
**kwargs
File "c:\users\嘿\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_install.py",line 878, in install
spinner=spinner,
File "c:\users\嘿\appdata\local\programs\python\python36\lib\site-packages\pip\utils\__init__.py",line 676, in call_subprocess
line =console_to_str(proc.stdout.readline())
File "c:\users\嘿\appdata\local\programs\python\python36\lib\site-packages\pip\compat\__init__.py",line 75, in console_to_str
return s.decode('utf_8')
UnicodeDecodeError:'utf-8' codec can't decode byte 0xba in position 18: invalid start byte
在命令行中输入
python
import OpenSSL
显示没有安装成功
输入pip install pyOpenSSL
pip install pyOpenSSL
同样报错
百度了一下,在知乎上有答主解答如下
打开了对应的py文件后,打开View->Options...,修改Line Numbers 为20 使pythonWin显示行号
把第73和75行的('utf_8') 改为 ('cp936'),保存,
再
pip install Scrapy
安装成功啦!!
再验证一下~
scrapy -version
然后还是试了一下,验证OpenSSL已经安装了。说明pip install Scrapy的时候会自动安装OpenSSL的。