当前位置: 首页 > article >正文

scrapy入门(深入)

Scrapy框架简介

image-20250320114955165

Scrapy是:由Python语言开发的一个快速、高层次的屏幕抓取和web抓取框架,用于抓取web站点并从页面中提取结构化的数据,只需要实现少量的代码,就能够快速的抓取。

  1. 新建项目 (scrapy startproject xxx):新建一个新的爬虫项目
  2. 明确目标 (编写items.py):明确你想要抓取的目标
  3. 制作爬虫 (spiders/xxspider.py):制作爬虫开始爬取网页
  4. 存储内容 (pipelines.py):设计管道存储爬取内容

注意!只有当调度器中不存在任何request了,整个程序才会停止,(也就是说,对于下载失败的URL,Scrapy也会重新下载。)

本篇文章不会讲基本项目创建,创建的话可以移步这个文章,基础的肯定没什么重要性,这篇说明一下一些比较细的知识

Scrapy 官网:https://scrapy.org/
Scrapy 文档:https://docs.scrapy.org/en/latest/
GitHub:https://github.com/scrapy/scrapy/

基本结构

image-20250319221256508

image-20250319203420077

定义爬取的数据结构

  1. 首先在items中定义一个需要爬取的数据结构

    class ScrapySpiderItem(scrapy.Item):# 创建一个类来定义爬取的数据结构name = scrapy.Field()title = scrapy.Field()url = scrapy.Field()
    

    那为什么要这样定义:

    在Scrapy框架中,scrapy.Field() 是用于定义Item字段的特殊类,它的作用相当于一个标记。具体来说:

    1. 数据结构声明
      每个Field实例代表Item中的一个数据字段(如你代码中的name/title/url),用于声明爬虫要收集哪些数据字段。
    2. 元数据容器
      虽然看起来像普通赋值,但实际可以通过Field()传递元数据参数:

    在这里定义变量之后,后续就可以这样进行使用

    item = ScrapySpiderItem()
    item['name'] = '股票名称'
    item['title'] = '股价数据'
    item['url'] = 'http://example.com'
    

    然后就可以输入scrapy genspider itcast "itcast.cn"命令来创建一个爬虫,爬取itcast.cn域里的代码

数据爬取

注意这里如果你是跟着菜鸟教程来的,一定要改为这样,在itcast.py中

import scrapyclass ItcastSpider(scrapy.Spider):name = "itcast"allowed_domains = ["iscast.cn"]start_urls = ["http://www.itcast.cn/channel/teacher.shtml"]def parse(self, response):filename = "teacher.html"open(filename, 'wb').write(response.body)

改为wb,因为返回的是byte数据,如果用w不能正常返回值

那么基本的框架就是这样:

from mySpider.items import ItcastItemdef parse(self, response):#open("teacher.html","wb").write(response.body).close()# 存放老师信息的集合items = []for each in response.xpath("//div[@class='li_txt']"):# 将我们得到的数据封装到一个 `ItcastItem` 对象item = ItcastItem()#extract()方法返回的都是unicode字符串name = each.xpath("h3/text()").extract()title = each.xpath("h4/text()").extract()info = each.xpath("p/text()").extract()#xpath返回的是包含一个元素的列表item['name'] = name[0]item['title'] = title[0]item['info'] = info[0]items.append(item)# 直接返回最后数据return items

爬取信息后,使用xpath提取信息,返回值转化为unicode编码后储存到声明好的变量中,返回

数据保存

主要有四种格式

  1. scrapy crawl itcast -o teachers.json
  2. scrapy crawl itcast -o teachers.jsonl //json lines格式
  3. scrapy crawl itcast -o teachers.csv
  4. scrapy crawl itcast -o teachers.xml

不过上面只是一些项目的搭建和基本使用,我们通过爬虫渐渐进入框架,一定也好奇这个框架的优点在哪里,有什么特别的作用

scrapy结构

pipelines(管道)

这个文件也就是我们说的管道,当Item在Spider中被收集之后,它将会被传递到Item Pipeline(管道),这些Item Pipeline组件按定义的顺序处理Item。每个Item Pipeline都是实现了简单方法的Python类,比如决定此Item是丢弃而存储。以下是item pipeline的一些典型应用:

  • 验证爬取的数据(检查item包含某些字段,比如说name字段)
  • 查重(并丢弃)
  • 将爬取结果保存到文件或者数据库中
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html# useful for handling different item types with a single interface
from itemadapter import ItemAdapterclass MyspiderPipeline:def process_item(self, item, spider):return item

settings(设置)

代码里给了注释,一些基本的设置

# Scrapy settings for mySpider project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
#     https://docs.scrapy.org/en/latest/topics/settings.html
#     https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#     https://docs.scrapy.org/en/latest/topics/spider-middleware.html
#项目名称
BOT_NAME = "mySpider"SPIDER_MODULES = ["mySpider.spiders"]
NEWSPIDER_MODULE = "mySpider.spiders"# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = "mySpider (+http://www.yourdomain.com)"
#是否遵守规则协议
# Obey robots.txt rules
ROBOTSTXT_OBEY = True# Configure maximum concurrent requests performed by Scrapy (default: 16)
#CONCURRENT_REQUESTS = 32 #最大并发量32,默认16# Configure a delay for requests for the same website (default: 0)
# See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#下载延迟3秒
#DOWNLOAD_DELAY = 3
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN = 16
#CONCURRENT_REQUESTS_PER_IP = 16# Disable cookies (enabled by default)
#COOKIES_ENABLED = False# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED = False# Override the default request headers:
#请求头
#DEFAULT_REQUEST_HEADERS = {
#    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
#    "Accept-Language": "en",
#}# Enable or disable spider middlewares
# See https://docs.scrapy.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
#    "mySpider.middlewares.MyspiderSpiderMiddleware": 543,
#}# Enable or disable downloader middlewares
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#DOWNLOADER_MIDDLEWARES = {
#    "mySpider.middlewares.MyspiderDownloaderMiddleware": 543,
#}# Enable or disable extensions
# See https://docs.scrapy.org/en/latest/topics/extensions.html
#EXTENSIONS = {
#    "scrapy.extensions.telnet.TelnetConsole": None,
#}# Configure item pipelines
# See https://docs.scrapy.org/en/latest/topics/item-pipeline.html
#ITEM_PIPELINES = {
#    "mySpider.pipelines.MyspiderPipeline": 300,
#}# Enable and configure the AutoThrottle extension (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/autothrottle.html
#AUTOTHROTTLE_ENABLED = True
# The initial download delay
#AUTOTHROTTLE_START_DELAY = 5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY = 60
# The average number of requests Scrapy should be sending in parallel to
# each remote server
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG = False# Enable and configure HTTP caching (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED = True
#HTTPCACHE_EXPIRATION_SECS = 0
#HTTPCACHE_DIR = "httpcache"
#HTTPCACHE_IGNORE_HTTP_CODES = []
#HTTPCACHE_STORAGE = "scrapy.extensions.httpcache.FilesystemCacheStorage"# Set settings whose default value is deprecated to a future-proof value
TWISTED_REACTOR = "twisted.internet.asyncioreactor.AsyncioSelectorReactor"
FEED_EXPORT_ENCODING = "utf-8"

spiders

爬虫代码目录,定义了爬虫的逻辑

import scrapy
from mySpider.items import ItcastItemclass ItcastSpider(scrapy.Spider):name = "itcast"allowed_domains = ["iscast.cn"]start_urls = ["http://www.itcast.cn/"]def parse(self, response):# 获取网站标题list=response.xpath('//*[@id="mCSB_1_container"]/ul/li[@*]')

实战(大学信息)

目标网站:爬取大学信息

base64:

aHR0cDovL3NoYW5naGFpcmFua2luZy5jbi9yYW5raW5ncy9iY3VyLzIwMjQ=

变量命名

在刚刚创建的itcast里更改一下域名,在items里改一下接收数据格式

itcast.py

import scrapy
from mySpider.items import ItcastItemclass ItcastSpider(scrapy.Spider):name = "itcast"allowed_domains = ["iscast.cn"]start_urls = ["https://www.shanghairanking.cn/rankings/bcur/2024"]def parse(self, response):# 获取网站标题list=response.xpath('(//*[@class="align-left"])[position() > 1 and position() <= 31]')item=ItcastItem()for i in list:name=i.xpath('./div/div[2]/div[1]/div/div/span/text()').extract()description=i.xpath('./div/div[2]/p/text()').extract()location=i.xpath('../td[3]/text()').extract()item['name']=str(name).strip().replace('\\n','').replace(' ','')item['description']=str(description).strip().replace('\\n','').replace(' ','')item['location']=str(location).strip().replace('\\n','').replace(' ','')print(item)yield item

这里xpath感不太了解的可以看我之前的博客

一些爬虫基础知识备忘录-xpath

items.py

# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.htmlimport scrapyclass ItcastItem(scrapy.Item):name = scrapy.Field()description=scrapy.Field()location=scrapy.Field()

pipelines.py

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html# useful for handling different item types with a single interface
import csv
from itemadapter import ItemAdapterclass MyspiderPipeline:def __init__(self):#在初始化函数中先创建一个csv文件self.f=open('school.csv','w',encoding='utf-8',newline='')self.file_name=['name','description','location']self.writer=csv.DictWriter(self.f,fieldnames=self.file_name)self.writer.writeheader()#写入第一段字段名def process_item(self, item, spider):self.writer.writerow(dict(item))#在写入的时候,要转化为字典对象print(item)return itemdef close_spider(self,spider):self.f.close()#关闭文件 

setting.py

# Scrapy settings for mySpider project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
#     https://docs.scrapy.org/en/latest/topics/settings.html
#     https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#     https://docs.scrapy.org/en/latest/topics/spider-middleware.html
#项目名称
BOT_NAME = "mySpider"SPIDER_MODULES = ["mySpider.spiders"]
NEWSPIDER_MODULE = "mySpider.spiders"# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = "mySpider (+http://www.yourdomain.com)"
#是否遵守规则协议
# Obey robots.txt rules
ROBOTSTXT_OBEY = False# Configure maximum concurrent requests performed by Scrapy (default: 16)
#CONCURRENT_REQUESTS = 32 #最大并发量32,默认16# Configure a delay for requests for the same website (default: 0)
# See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#下载延迟3秒
#DOWNLOAD_DELAY = 3
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN = 16
#CONCURRENT_REQUESTS_PER_IP = 16# Disable cookies (enabled by default)
#COOKIES_ENABLED = False# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED = False# Override the default request headers:
#请求头
DEFAULT_REQUEST_HEADERS = {"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Language": "en",
}# Enable or disable spider middlewares
# See https://docs.scrapy.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
#    "mySpider.middlewares.MyspiderSpiderMiddleware": 543,
#}# Enable or disable downloader middlewares
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#DOWNLOADER_MIDDLEWARES = {
#    "mySpider.middlewares.MyspiderDownloaderMiddleware": 543,
#}# Enable or disable extensions
# See https://docs.scrapy.org/en/latest/topics/extensions.html
#EXTENSIONS = {
#    "scrapy.extensions.telnet.TelnetConsole": None,
#}# Configure item pipelines
# See https://docs.scrapy.org/en/latest/topics/item-pipeline.html
ITEM_PIPELINES = {"mySpider.pipelines.MyspiderPipeline": 300,
}
LOG_LEVEL = 'WARNING'
# Enable and configure the AutoThrottle extension (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/autothrottle.html
#AUTOTHROTTLE_ENABLED = True
# The initial download delay
#AUTOTHROTTLE_START_DELAY = 5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY = 60
# The average number of requests Scrapy should be sending in parallel to
# each remote server
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG = False# Enable and configure HTTP caching (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED = True
#HTTPCACHE_EXPIRATION_SECS = 0
#HTTPCACHE_DIR = "httpcache"
#HTTPCACHE_IGNORE_HTTP_CODES = []
#HTTPCACHE_STORAGE = "scrapy.extensions.httpcache.FilesystemCacheStorage"# Set settings whose default value is deprecated to a future-proof value
TWISTED_REACTOR = "twisted.internet.asyncioreactor.AsyncioSelectorReactor"
FEED_EXPORT_ENCODING = "utf-8"

start.py

然后在myspider文件夹下可以创建一个start.py文件,这样我们直接运行这个文件即可,不需要使用命令

from scrapy import cmdline
cmdline.execute("scrapy crawl itcast".split())

然后我们就正常保存为csv格式啦!

image-20250320113721472

一些问题

实现继续爬取,翻页

scrapy使用yield进行数据解析和爬取request,如果想实现翻页或者在请求完单次请求后继续请求,使用yield继续请求如果这里你使用一个return肯定会直接退出,感兴趣的可以去深入了解一下

一些setting配置

LOG_LEVEL = 'WARNING'可以把不太重要的日志关掉,让我们专注于看数据的爬取与分析

然后管道什么的在运行前记得开一下,把原先注释掉的打开就行

另外robot也要记得关一下

然后管道什么的在运行前记得开一下

文件命名

csv格式的文件命名一定要和items中的命名一致,不然数据进不去


到了结束的时候了,本篇文章是对scrapy框架的入门,更加深入的知识请期待后续文章,一起进步!

相关文章:

scrapy入门(深入)

Scrapy框架简介 Scrapy是:由Python语言开发的一个快速、高层次的屏幕抓取和web抓取框架&#xff0c;用于抓取web站点并从页面中提取结构化的数据&#xff0c;只需要实现少量的代码&#xff0c;就能够快速的抓取。 新建项目 (scrapy startproject xxx)&#xff1a;新建一个新的…...

docker模拟Dos_SYN Flood拒绝服务攻击 (Ubuntu20.04)

目录 ✅ 一、实验环境准备&#xff08;3 个终端&#xff09; &#x1f449; 所以最终推荐做法&#xff1a; 2️⃣ 配置 seed-attacker 为攻击者&#xff0c;开启 telnet 服务&#xff1a; 3️⃣ 配置 victim-10.9.0.5 为受害者服务器&#xff0c;开启 telnet 客户端并监听&…...

使用 Ansys Fluent 评估金属管道腐蚀

金属管道的维护和完整性在石油和天然气、石化和供水等各个行业中都至关重要。腐蚀对这些管道构成了重大威胁&#xff0c;可能导致泄漏、结构故障和环境危害。Ansys Fluent 提供了一个强大的平台来建模和分析金属管道腐蚀。 腐蚀是一种自然过程&#xff0c;金属材料会因与环境发…...

firefly经典蓝牙和QProcess、QFileSystemWatcher记录

QProcess 默认不会启动一个 shell 来解析命令,而是直接调用操作系统的系统调用来启动外部程序。也就是通过fork一个子线程或者exec一个子进程来执行命令。 QProcess的参数模式 QProcess 需要明确指定命令的可执行文件路径或参数列表。 如果命令是一个可执行文件的路径…...

基于PySide6的CATIA自动化工具开发实战——空几何体批量清理系统

一、功能概述 本工具通过PySide6构建用户界面&#xff0c;结合PyCATIA库实现CATIA V5的自动化操作&#xff0c;提供两大核心功能&#xff1a; ​空几何体清理&#xff1a;智能识别并删除零件文档中的无内容几何体&#xff08;Bodies&#xff09;​空几何图形集清理&#xff1…...

Blender配置渲染设置并输出动画

在Blender中&#xff0c;渲染设置和渲染动画的选项位于不同的面板中。以下是具体步骤&#xff1a; 渲染设置 渲染设置用于配置输出格式、分辨率、帧率等参数。 打开右侧的 属性面板&#xff08;按 N 键可切换显示&#xff09;。 点击 “输出属性” 选项卡&#xff08;图标是…...

Spring 声明式事务应该怎么学?

1、引言 Spring 的声明式事务极大地方便了日常的事务相关代码编写&#xff0c;它的设计如此巧妙&#xff0c;以至于在使用中几乎感觉不到它的存在&#xff0c;只需要优雅地加一个 Transactional 注解&#xff0c;一切就都顺理成章地完成了&#xff01; 毫不夸张地讲&#xff…...

C++11 引入了的新特性与实例说明

C11 引入了许多重要的新特性&#xff0c;以下是一些关键特性及其对应的示例代码&#xff0c;用于体现这些特性的用法和优势。 1. 自动类型推导 (auto) auto 关键字允许编译器自动推导变量的类型&#xff0c;简化代码书写。 #include <iostream> #include <vector>…...

二手Mac验机过程

1.1 外观检查 螺丝是否拧过螺丝 1.2 关于本机中 序列号&#xff0c;盒子序列号&#xff0c;机器背部 核对参数 https://checkcoverage.apple.com/coverage 1.3 检查apple ID与查找 1 登出 iCloud、iTunes、FaceTime、iMessage 在 Mac 上打開「訊息」應用程式&#xff0c;從上方…...

从 0 到 1 掌握鸿蒙 AudioRenderer 音频渲染:我的自学笔记与踩坑实录(API 14)

最近我在研究 HarmonyOS 音频开发。在音视频领域&#xff0c;鸿蒙的 AudioKit 框架提供了 AVPlayer 和 AudioRenderer 两种方案。AVPlayer 适合快速实现播放功能&#xff0c;而 AudioRenderer 允许更底层的音频处理&#xff0c;适合定制化需求。本文将以一个开发者的自学视角&a…...

Android 13深度定制:SystemUI状态栏时间居中显示终极实战指南

一、架构设计与技术解析 1. SystemUI状态栏核心布局机制 层级结构 mermaid 复制 graph TDPhoneStatusBarView --> StatusBarContents[status_bar_contents]StatusBarContents --> LeftLayout[status_bar_left_side]StatusBarContents --> ClockLayout[Clock控件]Left…...

支持多系统多协议且可提速的下载工具

在网络下载需求日益多样的当下&#xff0c;一款好用的下载器能极大提升效率。今天就给大家介绍 AB Download Manager&#xff0c;它免费又开源&#xff0c;能适配 Windows 和 Linux 系统&#xff0c;带来超便捷的下载体验。 AB Download Manager 采用先进的多线程技术&#xf…...

【leetcode hot 100 22】括号生成

解法一&#xff1a;&#xff08;回溯法&#xff09;用两个整数记录左右括号数&#xff0c;以在回溯过程中保证先生成左括号&#xff0c;且左右括号数不能大于n。 class Solution {public List<String> generateParenthesis(int n) {List<String> result new Arra…...

如何在 HTML 中创建一个有序列表和无序列表,它们的语义有何不同?

大白话如何在 HTML 中创建一个有序列表和无序列表&#xff0c;它们的语义有何不同&#xff1f; 1. HTML 中有序列表和无序列表的基本概念 在 HTML 里&#xff0c;列表是一种用来组织信息的方式。有序列表就是带有编号的列表&#xff0c;它可以让内容按照一定的顺序呈现&#…...

【武汉·4月11日】Parasoft联合光庭信息研讨会|邀您共探AI赋能新机遇

Parasoft联合光庭信息Workshop邀您共探AI赋能新机遇 AI浪潮已至&#xff0c;你准备好了吗&#xff1f; 在智能网联汽车飞速发展的今天&#xff0c;AI技术正以前所未有的速度重塑行业生态。如何把握AI机遇&#xff0c;赋能企业创新&#xff1f; 4月11日&#xff0c;自动化软件…...

PHP PSR(PHP Standards Recommendations)介绍

PHP PSR&#xff08;PHP Standards Recommendations&#xff09;是 PHP 社区制定的一系列标准化规范&#xff0c;旨在统一 PHP 代码的编写方式、接口设计和开发实践&#xff0c;以提高代码的可读性、可维护性和互操作性。以下是核心 PSR 标准的解读和具体使用方法&#xff1a; …...

闻所闻尽:穿透声音的寂静,照见生命的本真

在《楞严经》的梵音缭绕中&#xff0c;"闻所闻尽"四个字如晨钟暮鼓&#xff0c;叩击着每个修行者的心门。这个源自观世音菩萨耳根圆通法门的核心概念&#xff0c;既是佛门修行的次第指引&#xff0c;更蕴含着东方哲学对生命本质的终极叩问。当我们穿越时空的帷幕&…...

F28335进入非法中断ILLEGAL_ISR定位

在非法中断函数中&#xff0c;再调用一个函数接口&#xff0c;比如save_illegal_error()&#xff0c;然后在save_illegal_error中实现如下代码&#xff1a; g_illegal_isr_sp 0;(这个是全局变量&#xff0c;需要先定义 &#xff09; asm( “ MOVW ACC, SP\n” " MOVL …...

PreparedStatement 和 Statement 从 功能、性能、安全性、适用场景 等维度详细对比分析

以下是 PreparedStatement 和 Statement 的对比分析&#xff0c;从 功能、性能、安全性、适用场景 等维度详细说明&#xff1a; 1. 核心区别 特性PreparedStatementStatement定义预编译的 SQL 语句&#xff0c;支持参数化查询执行静态 SQL 语句&#xff0c;不支持参数占位符安…...

VLAN综合实验报告

一、实验拓扑 网络拓扑结构包括三台交换机&#xff08;LSW1、LSW2、LSW3&#xff09;、一台路由器&#xff08;AR1&#xff09;以及六台PC&#xff08;PC1-PC6&#xff09;。交换机之间通过Trunk链路相连&#xff0c;交换机与PC、路由器通过Access或Hybrid链路连接。 二、实验…...

使用 Docker 部署 mysql 应用

使用 Docker 部署 环境搭建 Docker 安装文档 创建容器 在系统任意位置创建一个文件夹&#xff08;可选&#xff09; mkdir -p /opt/docker/mysql && cd /opt/docker/mysqlmkdir ./{conf,data,logs}搜索 & 拉取镜像 docker search mysql docker pull mysql:5.6启…...

美团Leaf分布式ID实战:深入解析雪花算法原理与应用

&#x1f4d6; 前言 在分布式系统中&#xff0c;全局唯一ID生成是保证数据一致性的核心技术之一。传统方案&#xff08;如数据库自增ID、UUID&#xff09;存在性能瓶颈或无序性问题&#xff0c;而美团开源的Leaf框架提供了高可用、高性能的分布式ID解决方案。本文重点解析Leaf…...

Midjourney使用教程—2.作品修改

当您已生成第一张Midjourney图像的时候&#xff0c;接下来该做什么&#xff1f;了解我们用于修改图像的工具&#xff01;使用 Midjourney 制作图像后&#xff0c;您的创意之旅就不会止步于此。您可以使用各种工具来修改和增强图像。 一、放大操作 Midjourney每次会根据提示词…...

【人工智能】LM Studio 的 GPU 加速:释放大模型推理潜能的极致优化

《Python OpenCV从菜鸟到高手》带你进入图像处理与计算机视觉的大门! 解锁Python编程的无限可能:《奇妙的Python》带你漫游代码世界 随着大语言模型(LLM)的广泛应用,其推理效率成为限制性能的关键瓶颈。LM Studio 作为一个轻量级机器学习框架,通过 GPU 加速显著提升了大…...

S32K144入门笔记(十七):PDB的API函数解读

文章目录 1. SDK中的函数2. API函数的释义 1. SDK中的函数 在SDK中并没有转为PDB设置专门的PAL驱动&#xff0c;在基本的DRIVER库中一共有21个API函数&#xff0c;本文将解读这些函数的功能。 2. API函数的释义 void PDB_DRV_Init(const uint32_t instance,const pdb_timer_…...

3.5 平滑滤波

请注意:笔记内容片面粗浅&#xff0c;请读者批判着阅读&#xff01; 一、引言 平滑空间滤波是数字图像处理中用于降低噪声和模糊细节的核心技术&#xff0c;常用于图像预处理或特定场景下的视觉效果优化。其核心思想是通过邻域像素的加权平均或统计操作&#xff0c;抑制高频噪…...

自动化测试框架pytest+requests+allure

Pytest requests Allure 这个框架基于python的的 Pytest 进行测试执行&#xff0c;并结合 Allure插件 生成测试报告的测试框架。采用 关键字驱动 方式&#xff0c;使测试用例更加清晰、模块化&#xff0c;同时支持 YAML 文件来管理测试用例&#xff0c;方便维护和扩展。 测试…...

Sympy入门之微积分基本运算

Sympy是一个专注于符号数学计算的数学工具&#xff0c;使得用户可以轻松地进行复杂的符号运算&#xff0c;如求解方程、求导数、积分、级数展开、矩阵运算等。本文&#xff0c;我们将详细讲解Sympy在微积分运算中的应用。 获取方式 pip install -i https://mirrors.tuna.tsin…...

Qemu-STM32(十):STM32F103开篇

简介 本系列博客主要描述了STM32F103的qemu模拟器实现&#xff0c;进行该项目的原因有两点: 作者在高铁上&#xff0c;想在STM32F103上验证一个软件框架时&#xff0c;如果此时掏出开发板&#xff0c;然后接一堆的线&#xff0c;旁边的人估计会投来异样的目光&#xff0c;特别…...

在 ABAP 开发工具 (ADT-ABAP Development Tools) 中创建ABAP 项目

第一步&#xff1a;安装 SAP NetWeaver 的 ABAP 开发工具 (ADT) 开发工具下载地址&#xff1a;https://tools.hana.ondemand.com/#abap 也可以在SAP Development Tools下载工具页面直接跳转到对应公开课教程页面&#xff0c;按课程步骤下载eclipse解压安装即可&#xff0c;过程…...