$ cd ~/Python/
$ mkdir Envs
$ cd Envs
$ virtualenv env_data
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.5'
New python executable in /Users/wupeng/Python/Envs/env_data/bin/python3.5
Also creating executable in /Users/wupeng/Python/Envs/env_data/bin/python
Installing setuptools, pip, wheel...done.
$ source env_data/bin/activate
(env_data) localhost:Envs wupeng$ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
appdirs (1.4.3)
packaging (16.8)
pip (9.0.1)
pyparsing (2.2.0)
setuptools (34.3.2)
six (1.10.0)
wheel (0.30.0a0)
localhost:~ wupeng$ mkvirtualenv article_spider
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.5'
New python executable in /Users/wupeng/Envs/article_spider/bin/python3.5
Also creating executable in /Users/wupeng/Envs/article_spider/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /Users/wupeng/Envs/article_spider/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/wupeng/Envs/article_spider/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/wupeng/Envs/article_spider/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/wupeng/Envs/article_spider/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/wupeng/Envs/article_spider/bin/get_env_details
(article_spider) localhost:~ wupeng$ echo $PATH
/Users/wupeng/Envs/article_spider/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
(article_spider) localhost:~ wupeng$ PYTHON
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
KeyboardInterrupt
>>> ^D
(article_spider) localhost:~ wupeng$ pip install -i https://pypi.douban.com/simple/ scrapy
创建爬虫
(article_spider) localhost:PycharmProjects wupeng$ cd ~/PycharmProjects/
(article_spider) localhost:PycharmProjects wupeng$ scrapy startproject ArticleSpider
New Scrapy project 'ArticleSpider', using template directory '/Users/wupeng/Envs/article_spider/lib/python3.5/site-packages/scrapy/templates/project', created in:
/Users/wupeng/PycharmProjects/ArticleSpider
You can start your first spider with:
cd ArticleSpider
scrapy genspider example example.com
(article_spider) localhost:PycharmProjects wupeng$ cd ArticleSpider/
(article_spider) localhost:ArticleSpider wupeng$ scrapy genspider jobbole blog.jobbole.com
Created spider 'jobbole' using template 'basic' in module:
ArticleSpider.spiders.jobbole
...
2017-04-01 12:47:30 [scrapy.core.engine] INFO: Spider closed (finished)
(article_spider) localhost:ArticleSpider wupeng$ scrapy shell http://blog.jobbole.com/110287/