本文轉自http://blog.csdn.net/absent1353/article/details/73381221
并加入補充
Python3.6安裝Scrapy爬蟲框架
Windows10 64位系統(tǒng)安裝Scrapy版本
更新pip
安裝 wheel
安裝lxml
安裝zope.interface
*安裝pyOpenSSL
安裝Twisted
安裝pywin32
安裝Scrapy
更新pip
python -m pip install --upgrade pip
若已經(jīng)是最新版pip, 則不用更新
安裝 wheel
pip install wheel
安裝lxml(本地安裝)
Python3.6版本,windows 10系統(tǒng)下,在(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
官方網(wǎng)站下載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位系統(tǒng),下載
Twisted?17.5.0?cp36?cp36m?win_amd64.whl,然后pip安裝。
pip install Twisted?17.5.0?cp36?cp36m?win_amd64.whl
從官方網(wǎng)站https://sourceforge.net/projects/pywin32/files/pywin32/Build%20220/下載對應版本的安裝包安裝即可。
創(chuàng)建以下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 結果如下: