本文转自http://blog.csdn.net/absent1353/article/details/73381221
并加入补充
Python3.6安装Scrapy爬虫框架
Windows10 64位系统安装Scrapy版本
更新pip
安装 wheel
安装lxml
安装zope.interface
*安装pyOpenSSL
安装Twisted
安装pywin32
安装Scrapy
更新pip
python -m pip install --upgrade pip
若已经是最新版pip, 则不用更新
安装 wheel
pip install wheel
安装lxml(本地安装)
Python3.6版本,windows 10系统下,在(http://www.lfd.uci.edu/~gohlke/pythonlibs/)找到lxml‑3.8.0‑cp36‑cp36m‑win_amd64.whl,采用pip方式安装。
pip install lxml‑3.8.0‑cp36‑cp36m‑win_amd64.whl
在(https://pypi.python.org/pypi/zope.interface#downloads)下载zope.interface对应版本的wheel文件,然后pip安装,下载zope.interface-4.4.2-cp36-cp36m-win_amd64.whl
pip install zope.interface-4.4.2-cp36-cp36m-win_amd64.whl
官方网站下载wheel文件,https://pypi.python.org/pypi/pyOpenSSL#downloads,如当前最新版本名称是pyOpenSSL-16.2.0-py2.py3-none-any.whl,下载后安装即可。
pip install pyOpenSSL-16.2.0-py2.py3-none-any.whl
同理,http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted下载wheel文件,利用pip安装即可。
如Python 3.6版本,Windows 64位系统,下载
Twisted‑17.5.0‑cp36‑cp36m‑win_amd64.whl,然后pip安装。
pip install Twisted‑17.5.0‑cp36‑cp36m‑win_amd64.whl
从官方网站https://sourceforge.net/projects/pywin32/files/pywin32/Build%20220/下载对应版本的安装包安装即可。
创建以下python文件pythonregistry.py并运行,注意installpath要与python安装路径一致
# -*- coding: utf-8 -*-
# Run from the command window (Run as Administrator!):
# python registerPython.py
# script to register Python 2.0 or later for use with win32all
# and other extensions that require Python registry settings
#
# written by Joakim Löw for Secret Labs AB / PythonWare
#
# source:
# http://www.pythonware.com/products/works/articles/regpy20.htm
import sys
from _winreg import *
# tweak as necessary
version = sys.version[:3]
installpath = sys.prefix
#installpath = "D:\Program Files\Python36" # 注意这里是python安装路径
regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (
installpath, installpath, installpath
)
def RegisterPy():
try:
reg = OpenKey(HKEY_LOCAL_MACHINE, regpath)
except EnvironmentError:
try:
print("No Key Found, attempting to register")
reg = CreateKey(HKEY_LOCAL_MACHINE, regpath)
SetValue(reg, installkey, REG_SZ, installpath)
SetValue(reg, pythonkey, REG_SZ, pythonpath)
CloseKey(reg)
except:
print("*** Unable to register!")
return
print("--- Python", version, "is now registered!")
return
if (QueryValue(reg, installkey) == installpath and
QueryValue(reg, pythonkey) == pythonpath):
CloseKey(reg)
print("=== Python", version, "is already registered!")
return
CloseKey(reg)
print("*** Unable to register!")
print("*** You probably have another Python installation!")
if __name__ == "__main__":
RegisterPy()
也是采用wheel形式安装Scrapy-1.4.0-py2.py3-none-any.whl
pip install Scrapy-1.4.0-py2.py3-none-any.whl
大功告成 输入scrapy 结果如下: