zoukankan      html  css  js  c++  java
  • 爬虫框架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
  • 相关阅读:
    CentOS7.5 搭建MyCat1.6.6
    idea快速搭建springboot项目
    MySQL存储过程中变量及循环的使用
    windows 安装 jdk1.8并配置环境变量
    CentOS7.5安装JDK1.8
    CentOS7.2安装MySql5.7并开启远程连接授权
    PHP高级工程师面试
    每日英语
    静态化
    php分页实例及其原理
  • 原文地址:https://www.cnblogs.com/feng1014/p/12403930.html
Copyright © 2011-2022 走看看