Ingredient:
- Python:Python 3.6.6(Python Downloads)
使用Python做爬虫时需要用到requests,Python2和Python3环境下安装略有不同,今天来介绍一下。
1 Mac上同时使用Python2和Python3
Mac环境自带了Python2,有时候要使用Python3,那么直接下载Python3的版本,然后在Mac上安装就可以了,这里下载Python 3.6.6。
2 安装requests
Python2和Python3环境下安装requests略有不同,主要是安装命令上略有差异。
2.1 Python2
sudo pip install requests
或者
sudo easy_install requests
2.2 Python3
pip3 install requests