使用豆瓣源安装插件
# pip install virtualenv
# 豆瓣源:https://pypi.douban.com/simple
pip install -i https://pypi.douban.com/simple/ virtualenv
1. 创建虚拟环境:
Windows+R进入cmd命令,进入目录E:\virtualEnv>
E:\virtualEnv>>virtualenv --python=C:\Python\Python35\python.exe Python-scrapy
--python=C:\Python\Python35\python.exe 代表Python安装路径
Python-scrapy 代表虚拟环境名称,生成位置为E:\virtualEnv\Python-scrapy
2.安装scrapy
pip install -i https://pypi.douban.com/simple/ scrapy
3.安装虚拟环境
pip install -i https://pypi.douban.com/simple/ virtualenvwrapper-win
workon
mkvirtualenv Project-scrapy
默认在如下目录生成虚拟环境C:\Users\Administrator\Envs\Project1
更改虚拟环境默认位置,新建系统变量WORKON_HOME,指定新位置E:\Envs
进入新虚拟环境目录Scripts
进入环境:activate.bat
退出环境:deactivate.bat
4. 创建Python项目
scrapy startproject ArticleSpider
You can start your first spider with:
cd ArticleSpider
scrapy genspider example example.com
pip install pypiwin32