进入cmd
C:\Users\XXX>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> import urllib.request
>>> urllib.request.urlopen('http://www.baidu.com')
0x00000268B6F2AA58>
>>> import re
>>>
C:\Users\mirror>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.get('http://www.baidu.com')
200]>
>>>
安装selenium
pip install selenium
from selenium import webdriver
browser = webdriver.Chrome()
browser.get('http://www.baidu.com')
browser.page_source
打开网址:http://phantomjs.org/download.html
下载phantomjs 解压
配置坏境变量
cmd输入phantomjs
pip install lxml
C:\Users\mirror>pip install beautifulsoup4
Collecting beautifulsoup4
Downloading https://files.pythonhosted.org/packages/9e/d4/10f46e5cfac773e22707237bfcd51bbffeaf0a576b0a847ec7ab15bd7ace/beautifulsoup4-4.6.0-py3-none-any.whl (86kB)
100% |████████████████████████████████| 92kB 164kB/s
Installing collected packages: beautifulsoup4
Successfully installed beautifulsoup4-4.6.0
C:\Users\mirror>pip install pyquery
Collecting pyquery
Downloading https://files.pythonhosted.org/packages/09/c7/ce8c9c37ab8ff8337faad3335c088d60bed4a35a4bed33a64f0e64fbcf29/pyquery-1.4.0-py2.py3-none-any.whl
Collecting cssselect>0.7.9 (from pyquery)
Downloading https://files.pythonhosted.org/packages/7b/44/25b7283e50585f0b4156960691d951b05d061abf4a714078393e51929b30/cssselect-1.0.3-py2.py3-none-any.whl
Requirement already satisfied: lxml>=2.1 in d:\mirror\anaconda3\lib\site-packages (from pyquery) (4.2.1)
Installing collected packages: cssselect, pyquery
Successfully installed cssselect-1.0.3 pyquery-1.4.0
pip install pymysql
pip install redis
pip install flask
pip install django
pip install jupyter