爬虫框架scrapy

1 #mac 安装scrapy
2 pip install scrapy
1 python 使用MySQL模块出现 ModuleNotFoundError: No module named 'mysql'
2 解决方法 pip install mysql-connector
3 
4 python使用mysql出现 mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported
5 解决方法 pip install mysql-connector-python
1 mac 安装软件。磁盘已坏,推出磁盘,应用不安全。
2 解决方法 sudo spctl --master-disable

python 爬虫知识

1 resp = requests.get(url)
2 #resp.text 和resp.content打印出的内容不同。前者经过自动解码,后者只是一个字节流。为什么?
3 #resp.text自动解码的过程。
4 #requests/adapt.py文件中的build_response方法返回服务器内容的解码方式。
5 #build_response方法中get_encoding_from_header方法位于requests/utils.py文件中。具体解析出服务器内容的编码方式。返回build_response到response.encoding。
6 #服务器没有说明编码的方式,则到requests/modules.py文件中有apparent_ecoding方法,里面有chardet。这是在服务器返回内容中查找是否有特殊码,于是解析出具体编码方式。
1 resp有text,content,cookies,headers,history
1 mysql_connector.MySQLInterfaceError: Python type list cannot be converted
2 Python连接mysql时,由于写入到MySQL中的一个时间变量类型设置不匹配引发的错误。将DATE转为DATETIME即可执行。

 

1 官网下载后的python程序在 /usr/local/cellar/python下。包括官网提供的IDE,python launch等。这其实就是类似于tomcat,nginx这些服务器的一种应用程序,里面有二进制可执行文件,有库函数等。
2 
3 有了Python程序后,还不能直接运行使用Python编写的用户程序。需要框架的作用。链接一些库函数才能真正执行。
4 下载的框架路径 /usr/local/Frameworks/python.framework 
5 
6 编写一些Python程序,需要用到一些第三方的Python库。安装到MAC的位置
7 /usr/local/bin,/usr/local/lib/python3.7/site-packages

 

posted @ 2020-03-03 18:41  岐岐卡卡西  阅读(151)  评论(0编辑  收藏  举报