Ubuntu设置国内镜像源

news2025/2/23 10:40:07

文章目录

  • 环境
  • 背景
  • 方法1:使用清华大学镜像源
    • 使用HTTP方式
    • 使用HTTPS方式
  • 方法2:使用阿里云镜像源
  • 总结
  • 参考

环境

  • RHEL 9.3
  • Docker Community 24.0.7
  • ubuntu:latest Docker image (jammy 22.04)

背景

启动Ubuntu容器:

docker run -it ubuntu

在容器里:

vim
bash: vim: command not found

查看Ubuntu版本:

cat /etc/issue
Ubuntu 22.04.3 LTS \n \l

安装vim:

apt install vim
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package vim

失败了。要先 apt update 更新package列表:

apt update

然后再安装vim:

apt install vim

这次安装成功了。但问题是,国内在连接Ubuntu网站的时候,特别慢,还经常连接失败。

查看 /etc/apt/sources.list 文件,如下:

cat /etc/apt/sources.list
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ jammy universe
# deb-src http://archive.ubuntu.com/ubuntu/ jammy universe
deb http://archive.ubuntu.com/ubuntu/ jammy-updates universe
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu/ jammy multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted
deb http://security.ubuntu.com/ubuntu/ jammy-security universe
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security universe
deb http://security.ubuntu.com/ubuntu/ jammy-security multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security multiverse

为了提高效率,可以配置使用国内的Ubuntu镜像源。对于不同的镜像源,配置方法基本都一样。本文以清华大学镜像源和阿里云镜像源为例,介绍如何配置Ubuntu镜像源。

方法1:使用清华大学镜像源

打开浏览器,访问 https://mirror.tuna.tsinghua.edu.cn/help/ubuntu

在这里插入图片描述

注意设置适当的选项。例如,我使用的是 Ubuntu 22.04,代号是 jammy

使用HTTP方式

不勾选“是否使用HTTPS”选项。

其生成的内容如下:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# # deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse

要用这些内容替换容器里的 /etc/apt/sources.list 文件。

替换之前,先备份文件:

cp /etc/apt/sources.list /etc/apt/sources.list.bak

由于没有vi,无法直接编辑文件,可以先在宿主机上把文件编辑好,然后使用 docker cp 命令向容器里复制文件,例如:

docker cp /tmp/sources.list.tsinghua.http a65352ec73a9:/etc/apt/sources.list

在容器里查看文件:

ll -d /etc/apt/sources.list*
-rw-r--r--. 1 1000 1000 1122 Jan  8 01:31 /etc/apt/sources.list
-rw-r--r--. 1 root root 2403 Jan  8 07:14 /etc/apt/sources.list.bak
drwxr-xr-x. 2 root root    6 Apr  8  2022 /etc/apt/sources.list.d/

文件权限不同,不知道会不会有什么影响,最好还是和原来的文件保持一致吧:

chown root:root /etc/apt/sources.list

更新package列表:

apt update
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease [270 kB]
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates InRelease [119 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports InRelease [109 kB]
Get:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/multiverse amd64 Packages [266 kB]
Get:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/restricted amd64 Packages [164 kB]         
Get:6 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/main amd64 Packages [1792 kB]                       
Get:7 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 Packages [17.5 MB]                   
Get:8 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main amd64 Packages [1606 kB]
Get:9 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/universe amd64 Packages [1307 kB]
Get:10 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/multiverse amd64 Packages [49.8 kB]
Get:11 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/restricted amd64 Packages [1611 kB]
Get:12 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]      
Get:13 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports/universe amd64 Packages [28.1 kB]
Get:14 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports/main amd64 Packages [50.4 kB]
Get:15 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1047 kB]
Get:16 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1332 kB]
Get:17 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [44.0 kB]
Get:18 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [1582 kB]
Fetched 29.0 MB in 4s (7161 kB/s)                           
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

配置镜像源成功。

现在,就可以安装vim了:

apt install vim

使用HTTPS方式

如果要使用HTTPS,则需要安装证书,否则apt update会有警告,实际上并没有update成功,安装vim也会失败。

勾选“是否使用HTTPS”选项。

其生成的内容如下:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse

替换 /etc/apt/sources.list 文件,方法同上。

更新package列表:

apt update
Ign:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease
Ign:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates InRelease
Ign:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports InRelease
Get:4 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Ign:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease
Ign:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates InRelease
Ign:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports InRelease
Get:5 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1332 kB]
Get:6 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1047 kB]
Ign:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease
Ign:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates InRelease
Get:7 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [44.0 kB]                 
Get:8 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [1582 kB]                       
Ign:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports InRelease                                          
Err:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease                                                                                                                                                                           
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443]
Err:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates InRelease                                                                                                                                                                   
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443]
Err:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports InRelease                                                                                                                                                                 
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443]
Fetched 4116 kB in 7s (552 kB/s)                                                                                                                                                                                                            
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-updates/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-backports/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-updates/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-backports/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-updates/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-backports/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-updates/InRelease: No system certificates available. Try installing ca-certificates.
W: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-backports/InRelease: No system certificates available. Try installing ca-certificates.
W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy/InRelease  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443]
W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-updates/InRelease  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443]
W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-backports/InRelease  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443]
W: Some index files failed to download. They have been ignored, or old ones used instead.

可见,更新是有问题的。

安装vim:

apt install vim
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 vim : Depends: libgpm2 (>= 1.20.7) but it is not installable
       Depends: libpython3.10 (>= 3.10.0) but it is not going to be installed
       Depends: libsodium23 (>= 1.0.14) but it is not installable
E: Unable to correct problems, you have held broken packages.

安装失败。

首先要解决证书的问题,安装证书:

apt install --reinstall ca-certificates

注意:在安装证书前,还是要先做一次 apt update ,否则找不到 ca-certificates 包。

注:能够安装成功,因为连接的是 http://security.ubuntu.com/ubuntu ,是HTTP协议。但是,这还是连接了国外网站。如果连接不上,则需要改为从国内镜像网站下载安装证书(注意清华镜像站上有一个“强制安全更新使用镜像”选项,勾选之后,则使用清华镜像源),或者手工下载安装证书(没试过)。

接下来,再次 apt updateapt install vim ,就能更新package列表和安装vim了。

方法2:使用阿里云镜像源

和使用清华镜像源的方法基本是一致的。

打开浏览器,访问 https://developer.aliyun.com/mirror/ubuntu

在这里插入图片描述

找到对应的Ubuntu版本,其内容如下:

deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse

注意:这里有同样的HTTPS证书问题,同样也有两种解决方法:

  • 把所有的 https 改成 http
  • 在包含 security 的部分里,把 https 改为 http ,然后先安装证书,再更新package列表和安装软件

步骤和使用清华镜像源是一样的:在容器里备份 /etc/apt/sources.list 文件,在宿主机上创建好新文件,然后把文件复制到容器里,最后修改文件权限。

接下来,如果是使用HTTP就直接 apt update ,如果是使用HTTPS就需要先 apt update ,再 apt install --reinstall ca-certificates 安装证书,然后再 apt update

最后,运行 apt install vim ,安装vim。

总结

步骤如下:

  1. 找到Ubuntu镜像源网站
  2. 找到Ubuntu版本所对应的配置镜像源的内容
  3. 修改Ubuntu系统里的 /etc/apt/sources.list 文件
  4. apt update
    1. 如果是使用HTTP ,则直接更新
    2. 如果是使用HTTS,则要先更新一次(security用HTTP方式),再安装证书,然后再更新一次
  5. 至此,配置镜像源完成,就可以安装软件了。

参考

  • https://mirror.tuna.tsinghua.edu.cn/help/ubuntu
  • https://developer.aliyun.com/mirror/ubuntu

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1370689.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

2024,给管理者的三点建议

2024年,随着市场变化日新月异,各行各业竞争愈演愈烈,很多企业越发注重内部管理工作,管理者面临压力是必然的。在这样的情境下,作为管理者,应该怎么办呢?华恒智信根据多年的管理咨询服务经验&…

【2024系统架构设计】 系统架构设计师第二版-通信系统架构设计理论与实践

目录 一 通信系统网络架构 二 网络构建的关键技术 三 网络构建和设计方法 四 案例分析 注:本节内容可作为知识储备,做一个基本的了解即可。

Opencv实验合集——实验九:姿势估计

在上一章节(相机校准),你已经找到了相机矩阵,畸变系数等等参数。给出一个图案图像,我们便可以利用上面的信息用于计算其姿势,或者物体在空间中位于何处,比如如何旋转,如何移动等等问题。对于一个平面物体&a…

Google Breakpad使用方法

源码下载地址:https://chromium.googlesource.com/breakpad/breakpad 依赖头文件下载地址: https://chromium.googlesource.com/linux-syscall-support Breakpad由三个主要组件: client 是一个库, 以library的形式内置在应用中&#xff0c…

Mongodb使用指定索引删除数据

回顾Mongodb删除语法 db.collection.deleteMany(<filter>,{writeConcern: <document>,collation: <document>,hint: <document|string>} ) 删除语法中&#xff0c;除了指定过滤器外&#xff0c;还可以指定写入策略&#xff0c;字符序和使用的索引。 …

分布式系统架构设计之分布式消息队列中间件的技术选型报告

1、主流消息队列中间件 01 Kafka 基本原理 Kafka 基于发布-订阅模式&#xff0c;它维护了一个或多个 Topic&#xff0c;生产者将消息发送到 Topic&#xff0c;消费者从 Topic 中读取消息。Kafka 强调高吞吐量&#xff0c;通过批量处理、顺序 I/O 和零拷贝等技术实现高性能 …

【算法Hot100系列】搜索插入位置

💝💝💝欢迎来到我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学习,不断总结,共同进步,活到老学到老导航 檀越剑指大厂系列:全面总结 jav…

从起高楼到楼塌了的中台战略 —— 业务中台、数据中台、技术中台

目录 一. 前言 二. 中台能力总体框架 三. 业务中台 四. 数据中台 五. 技术中台 5.1. API 网关 5.2. 开发框架 5.3. 微服务治理 5.4. 分布式数据库 5.5. 数据处理组件 六. 阿里拆中台的原因和意义 七. 总结 一. 前言 中台是近年来互联网行业的一个热门话题。它最早是…

【STM32】| 01——常用外设 | USART

系列文章目录 【STM32】| 01——常用外设 | USART 失败了也挺可爱&#xff0c;成功了就超帅。 文章目录 前言1. 基础理论1.1 并行通信和串行通信1.2 同步通信和异步通信1.3 单工/半双工/全双工1.4 电平信号(RS232/TTL)和差分信号(RS485)1.5 端口(COM) 2. 串口理论2.1 串口物理…

基于apache的http文件服务配置

背景&#xff1a; 公司的产品使用的第三方模组可以OTA&#xff0c;厂家提供的是window开启软件&#xff0c;这样就可以在本机做http下载服务器&#xff0c;然后使用端口映射的方式&#xff0c;公开到外网&#xff0c;这样就可以进行4G网络访问内网服务器了。但这个有个弊端&am…

【C++】—— 工厂模式详解

目录 &#xff08;一&#xff09;工厂模式的特点 &#xff08;二&#xff09;工厂模式分类 1、简单工厂模式 2、工厂方法模式 3、抽象工厂模式 &#xff08;三&#xff09;总结与回顾 &#xff08;一&#xff09;工厂模式的特点 1、优势 ⼯⼚模式是⼀种创建型设计模式&a…

【大数据进阶第三阶段之Hue学习笔记】Hue的安装和使用

1、 Hue的安装 1.1 上传解压安装包 Hue的安装支持多种方式&#xff0c;包括rpm包的方式进行安装、tar.gz包的方式进行安装以及cloudera manager的方式来进行安装等&#xff0c;我们这里使用tar.gz包的方式来进行安装 Hue的压缩包的下载地址&#xff1a; http://archive.cloude…

C++|19.C++类与结构体对比

类和结构体 类和结构体本质上并没有太大区别。 但两者在默认上有所区别。 类默认成员变量是私有的&#xff0c;而结构体默认成员变量是公有的。 也就是说&#xff0c;对于一个类来说&#xff0c;会默认使用private去保护其内部成员变量使得无法直接访问到其内部的变量。 同时从…

CANoe中的AutoSequence

简单介绍&#xff1a; AutoSequence是一种简单的&#xff0c;快速的类似脚本的一个可视化自动脚本插件。使用起来非常方便&#xff0c;甚至在很多时候能够代替一些简单的脚本。 1&#xff1a;Automation工程的创建 &#xff08;1.1&#xff09;打开Automation插件,双击这个插…

TypeScript进阶(一)深入理解类和接口

✨ 专栏介绍 TypeScript是一种由微软开发的开源编程语言&#xff0c;它是JavaScript的超集&#xff0c;意味着任何有效的JavaScript代码都是有效的TypeScript代码。TypeScript通过添加静态类型和其他特性来增强JavaScript&#xff0c;使其更适合大型项目和团队开发。 在TypeS…

【2024最新-python3小白零基础入门】No2.python基础语法

文章目录 1 编码2 标识符规则3 python保留字4 注释5 行与缩进6 多行语句7 数字(Number)类型8 字符串(String)9 空行10 等待用户输入11 同一行显示多条语句12 import 与 from...import 环境准备&#xff0c;打开pycharm,新建一个python文件 文件名称随便&#xff0c;可中文可英文…

golang 记录一次协程和协程池的使用,利用ants协程池来处理定时器导致服务全部阻塞

前言 在实习的项目中有一个地方遇到了需要协程池的地方&#xff0c;在mt推荐下使用了ants库。因此在此篇记录一下自己学习使用此库的情况。 场景描述 此服务大致是一个kafka消息接收、发送相关。接收消息&#xff0c;根据参数设置定时器进行重发。 通过这里新建kafka服务&a…

ffmpeg[学习(四)](代码实现) 实现音频数据解码并且用SDL播放

0、作者杂谈 CSDN大多数都是落后的&#xff0c;要么是到处复制粘贴的&#xff0c;对于初学者我来说困惑了很久&#xff0c;大多数CSDN文章都是使用旧的API &#xff0c;已经被否决了&#xff0c;于是我读一些官方文档&#xff0c;和一些开源项目音视频的输出过程&#xff0c;写…

CCSC,一种CPU架构

core-circuit-separate-computer 核与执行电路的分离&#xff0c;最初是为了省电。 用寄存器实现这种分离。 V寄存器控制着执行电路的供电&#xff0c;V0则不供电&#xff0c;进入省电模式&#xff1b;V1则供电&#xff0c;进入工作模式。 P寄存器是parameter-register&#xf…

Qt应用-实现图像截取功能类似QQ上传头像截取功能

本文演示利用Qt实现图像截取功能类似QQ上传头像截取功能。 效果如下,通过移动中间的裁剪区域可以获得一张裁剪后的图片。 目录