1.安装python
第一步,我们先来安装Python,博主选择的版本是最新的2.7.13最新版本。windows下面的Python安装一般是通过软件安装包安装而不是命令行,所以我们首先要在Python的官方主页上面下载最新的Python安装包。下载地址是:https://www.python.org/downloads/。
安装之后要在属性哪里设置环境变量,右键我的电脑 -> 属性 -> 点击高级系统设置 -> 点击环境变量 -> 点击PATH -> 在最后面加上我们的Python安装路径 -> 点击确定
为了检查我们的python是否安装成功,可以在命令窗口中((开始->运行->输入cmd然后回车)输入python进行查询,
安装成功便会出现一下结果:
C:\Users\>python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
2.安装pip
我安装的2.7.13这个版本是没有带pip的要去官网下载,https://pip.pypa.io/en/latest/installing.html。
进去官网》点击 get-pip.py》里面是一些代码》复制全部》在script下》保存为get-pip.py
打开cmd》直接将get-pip.py拉进cmd》按enter键就会直接安装了
pip安装成功后,在cmd下执行pip,将会有以下提示。
Usage:
pip <command> [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
help Show help for commands.
3.安装scrapy
打开cmd输入pip install Scrapy
就会出现以下内容
C:\Users>pip install Scrapy
Requirement already satisfied: Scrapy in e:\python27\lib\site-packages
Requirement already satisfied: service-identity in e:\python27\lib\site-packages (from Scrapy)
Requirement already satisfied: parsel>=1.1 in e:\python27\lib\site-packages (from Scrapy)
Requirement already satisfied: six>=1.5.2 in e:\python27\lib\site-packages (from Scrapy)
Requirement already satisfied: w3lib>=1.17.0 in e:\python27\lib\site-packages (from Scrapy)
Requirement already satisfied: lxml in e:\python27\lib\site-packages (from Scrapy)
Requirement already satisfied: Twisted>=13.1.0 in e:\python27\lib\site-packages (from Scrapy)
Requirement already satisfied: pyOpenSSL in e:\python27\lib\site-packages (from Scrapy)
Requirement already satisfied: PyDispatcher>=2.0.5 in e:\python27\lib\site-packages (from Scrapy)
打开Python27》scripts下面会出现scrapy.exe
打开cmd将scrapy.exe直接拉进去,回车,就会自动安装了
重新打开cmd,输入python
C:\Users\>python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
在python下面输入import scrapy按回车,没有报错就是安装成功