当前位置:首页>python>在线安装:Linux装Python,两行命令搞定!手把手教你避开所有坑

在线安装:Linux装Python,两行命令搞定!手把手教你避开所有坑

  • 2026-04-13 20:01:45
在线安装:Linux装Python,两行命令搞定!手把手教你避开所有坑

在线安装方式适合绝大多数使用场景,简单、快速、依赖自动处理。如果你需要安装官方仓库里没有的版本,或者最新版,可以配合 PPA / SCL 扩展仓库。如果你是第一次在 Linux 上装 Python,跟着做就行,每一步都有注释和期待回显,踩过的坑我帮你绕。

1. 写在前面:你真的需要重新装 Python 吗?

绝大多数 Linux 发行版已经预装了 Python,但版本不一定是你想要的。比如 Ubuntu 20.04 默认自带 Python 3.8,CentOS 7 自带 Python 2.7(还保留着,主要是系统工具依赖它)。

所以我们要先搞清楚两件事:

  1. 系统里有没有 Python?版本是多少?
  2. 我需要什么版本?

在线安装是最简单、最适合新手的方式。本质上就是让系统的包管理器(apt/yum/dnf)直接帮你从官方软件仓库下载并安装。优点是全程一两条命令搞定,依赖关系自动处理;缺点是仓库里的版本不一定是最新的(比如 Ubuntu 22.04 官方仓库里的 Python 3 版本是 3.10,而不是 3.12)。

如果你需要指定特定版本,或者最新版,建议配合 deadsnakes PPA(Ubuntu)或 Software Collections(CentOS/RHEL),下文会详细介绍。


2. 环境确认:搞清楚你在哪台机器上操作

在开始之前,先用几条命令确认自己的操作环境。

2.1 查看 Linux 发行版

# 查看发行版信息,这是最通用的命令,几乎所有 Linux 发行版都有这个文件cat /etc/os-release

期待输出(以 Ubuntu 22.04 为例):

NAME="Ubuntu"VERSION="22.04.3 LTS (Jammy Jellyfish)"ID=ubuntuID_LIKE=debianPRETTY_NAME="Ubuntu 22.04.3 LTS"VERSION_ID="22.04"HOME_URL="https://www.ubuntu.com/"SUPPORT_URL="https://help.ubuntu.com/"BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"...

如果你是 CentOS / RHEL,输出里的 NAME 字段会显示 CentOS Linux 或 Red Hat Enterprise Linux

# 备用命令,lsb_release 在 Debian 系发行版上更直观lsb_release -a# 如果上面两个都没用,试这个uname -a

uname -a 期待输出:

Linux hostname 5.15.0-88-generic #98-Ubuntu SMP Mon Oct 2 15:18:56 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

重点看 x86_64——这说明你是 64 位系统,Python 现代版本都支持;如果看到 aarch64 说明你是 ARM 架构(比如树莓派、部分云服务器),同样没问题,包管理器会自动处理架构差异。

2.2 查看当前用户权限

# 查看当前登录用户whoami

期待输出:

ubuntu

如果输出是 root,说明你直接在 root 用户下,后面的命令不需要 sudo 前缀。如果是普通用户,安装命令需要加 sudo,系统会提示你输入密码。


3. 适配系统与最低配置要求

3.1 支持的发行版

发行版
版本
包管理器
备注
Ubuntu
18.04 / 20.04 / 22.04 / 24.04
apt
推荐首选
Debian
10 / 11 / 12
apt
与 Ubuntu 同源
Linux Mint
19 / 20 / 21
apt
基于 Ubuntu
CentOS
8 / 9 Stream
dnf
RHEL
7 / 8 / 9
yum / dnf
企业版

CentOS 7 特别说明:CentOS 7 已于 2024 年 6 月 30 日正式停止维护(EOL),官方仓库不再更新。如果你还在使用 CentOS 7,建议尽快迁移到 CentOS Stream 9、Rocky Linux 或 AlmaLinux。

3.2 最低硬件配置

Python 解释器本身非常轻量,对硬件几乎没什么要求,但要保证安装过程顺利完成:

配置项
最低要求
推荐
CPU
单核,任意架构
双核及以上
内存(RAM)
512 MB
1 GB 及以上
磁盘空间
500 MB(含依赖)
2 GB(有余量)
网络
可访问互联网
带宽 1 Mbps 以上

磁盘空间建议留足:Python 本体大约 100-200 MB,加上 pip、开发头文件、标准库等,实际占用在 300-500 MB 左右。如果后续要装 NumPy、Pandas 等科学计算库,建议磁盘空间至少预留 2 GB。


4. 检查系统是否已安装 Python

这一步是必做的,别跳过。 很多报错的根源就是系统里有多个版本的 Python,安装之前搞清楚现状,省去后面的麻烦。

4.1 检查 Python 3

# 检查 python3 命令是否存在,并查看版本python3 --version

期待输出(已安装):

Python 3.10.12

如果输出如下,说明 python3 未安装:

bash: python3: command not found

4.2 检查 Python 2(了解遗留情况)

# 检查 python2 或 python 命令(部分老系统)python2 --versionpython --version

期待输出(CentOS 7 默认环境):

Python 2.7.5

重要提醒:Python 2 已于 2020 年 1 月 1 日正式停止维护,千万不要用 Python 2 做新项目开发。但 CentOS 7 等老系统的某些系统工具依赖 Python 2,不要随意卸载,否则可能导致系统工具异常。

4.3 查看 Python 的安装路径

# 查看 python3 命令对应的实际路径which python3# 查看所有 python3 相关的路径whereis python3

期待输出:

/usr/bin/python3python3: /usr/bin/python3 /usr/bin/python3.10 /usr/lib/python3 /usr/lib/python3.10         /usr/lib/python3.11 /etc/python3 /etc/python3.10 /usr/share/python3         /usr/share/man/man1/python3.1.gz

4.4 查看系统里所有已安装的 Python 版本

# 列出 /usr/bin 下所有以 python 开头的可执行文件ls /usr/bin/python*

期待输出(Ubuntu 22.04):

/usr/bin/python3   /usr/bin/python3.10   /usr/bin/python3.11

这说明系统里同时有 Python 3.10 和 Python 3.11,python3 命令默认指向 3.10。


5. 在线安装方式详解

5.1 apt 安装(Debian / Ubuntu / Linux Mint)

5.1.1 更新软件包索引

# 在安装任何软件之前,先更新本地的软件包列表索引# 这一步相当于让系统去仓库"刷新目录",确保拿到的版本信息是最新的# -y 参数表示遇到确认提示时自动回答 yes,省去手动确认sudo apt update

期待输出(节选):

Hit:1 http://archive.ubuntu.com/ubuntu jammy InReleaseHit:2 http://archive.ubuntu.com/ubuntu jammy-updates InReleaseHit:3 http://archive.ubuntu.com/ubuntu jammy-backports InReleaseHit:4 http://security.ubuntu.com/ubuntu jammy-security InReleaseReading package lists... DoneBuilding dependency tree... DoneReading state information... Done

看到 Done 就说明索引更新成功,可以继续下一步。

5.1.2 安装 Python 3

# 安装 Python 3(官方仓库默认版本)# python3 是包名,apt 会自动解析它需要的所有依赖并一起安装sudo apt install python3 -y

期待输出(节选):

Readingpackagelists... DoneBuildingdependencytree... DoneReadingstateinformation... DoneThefollowingadditionalpackageswillbeinstalled:libpython3-stdliblibpython3.10-minimallibpython3.10-stdlibpython3-minimalpython3.10python3.10-minimalSuggestedpackages:python3-docpython3-tkpython3-venvThefollowingNEWpackageswillbeinstalled:python3python3-minimalpython3.10python3.10-minimal ...upgraded, 8 newlyinstalled, 0 toremoveand 2 notupgraded.Needtoget 4,596 kBofarchives.Afterthisoperation, 18.9MBofadditionaldiskspacewillbeused....Settinguppython3 (3.10.6-1~22.04) ...Processingtriggersforman-db (2.10.2-1) ...

安装完成后最后几行会显示版本配置信息,没有报错就说明安装成功。

5.1.3 安装 pip 和开发工具

# 安装 pip3(Python 的包管理工具,开发必备)# python3-pip 是 pip 的包名sudo apt install python3-pip -y# 安装 Python 开发头文件(编译扩展模块时需要)# 比如安装 cryptography、Pillow 等有 C 扩展的包时,没有这个会报错sudo apt install python3-dev -y# 安装 venv 模块(用于创建虚拟环境)sudo apt install python3-venv -y# 安装构建工具(编译依赖时需要)sudo apt install build-essential -y

为什么要装这几个?python3-pip 让你能用 pip install 命令装第三方库;python3-dev 在编译有 C 扩展的包时必须有;build-essential 包含 gcc 编译器,是编译任何 C 代码的基础;python3-venv 是后面创建虚拟环境必须的。建议一次性装全,省得后面缺东西。

5.1.4 安装指定版本的 Python(deadsnakes PPA)

如果官方仓库的版本太旧,你需要更新的 Python 版本,可以通过 deadsnakes PPA 安装。deadsnakes 是一个专门维护 Python 各个版本的第三方源,Ubuntu 社区广泛使用,安全可靠。

# 安装 software-properties-common,它提供 add-apt-repository 命令sudo apt install software-properties-common -y# 添加 deadsnakes PPA 源# 添加后系统就能从这个源获取更多 Python 版本sudo add-apt-repository ppa:deadsnakes/ppa

期待输出(部分):

 Deadsnakes PPA More info: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppaPress [ENTER] tocontinueor Ctrl-c to cancel adding it.Fetching: deadsnakes/ppaOKUpdating from such repository can't be done securely so disabling it for now....

按 Enter 确认后继续:

# 更新软件包索引,让 apt 能识别到新加的 deadsnakes 源里的包sudo apt update# 安装指定版本,例如 Python 3.12# 把 3.12 换成你需要的版本号即可,例如 python3.11、python3.9 等sudo apt install python3.12 -y# 安装对应版本的 venv 和 dev 工具sudo apt install python3.12-venv python3.12-dev -y

期待输出:

Readingpackagelists... Done...ThefollowingNEWpackageswillbeinstalled:python3.12python3.12-devpython3.12-minimalpython3.12-venv...Settinguppython3.12 (3.12.2-1+jammy1) ...

安装完成后,用 python3.12 --version 验证即可。


5.2 dnf 安装(CentOS 8+ / Fedora / RHEL 8+)

dnf 是 yum 的升级版,功能更强,性能更好,语法基本一样。CentOS 8 / Stream 及更新版本默认使用 dnf

5.2.1 更新 dnf 缓存

# 更新本地软件包元数据# dnf 的缓存刷新命令,等同于 apt updatesudo dnf makecache

期待输出:

CentOS Stream 9 - BaseOS                         32 MB/s |  11 MB     00:00CentOS Stream 9 - AppStream                      52 MB/s |  27 MB     00:00CentOS Stream 9 - Extras packages               8.1 kB/s |  18 kB     00:02Last metadata expiration check0:00:01 ago on ...Metadata cache created.

5.2.2 查看可用的 Python 版本

# 查看官方仓库中可用的所有 Python 相关包# 这样可以确认哪些版本可以直接安装,避免瞎猜dnf list available | grep python3

期待输出(节选):

python3.x86_64         3.11.5-1.el9baseospython3-devel.x86_64   3.11.5-1.el9appstreampython3-pip.noarch     23.3.1-1.el9appstreampython3.11.x86_64      3.11.5-1.el9baseospython3.12.x86_64      3.12.1-1.el9crb

5.2.3 安装 Python 3

# 安装仓库默认版本的 Python 3sudo dnf install python3 -y# 安装 pipsudo dnf install python3-pip -y# 安装开发工具sudo dnf install python3-devel -y# 安装编译工具组sudo dnf groupinstall "Development Tools" -y

期待输出(安装 python3 节选):

Dependencies resolved.=================================================================== Package           Architecture    Version              Repository   Size===================================================================Installing: python3           x86_64          3.11.5-1.el9         baseos      26 kInstalling dependencies: python3-libs      x86_64          3.11.5-1.el9         baseos     7.9 M python3-pip       noarch          23.3.1-1.el9         appstream  2.9 M...Installed:  python3-3.11.5-1.el9.x86_64  python3-libs-3.11.5-1.el9.x86_64Complete!

5.2.4 安装指定版本(Fedora 系)

Fedora 的官方仓库通常比较激进,可以直接安装较新的 Python 版本:

# 安装 Python 3.12(如果仓库里有的话)sudo dnf install python3.12 -y# 安装对应的 pip 和 develsudo dnf install python3.12-pip python3.12-devel -y

6. 安装完成后的验证与基础配置

安装完成之后别急着用,先做几个验证,确保环境是正常的。

6.1 验证 Python 版本

# 验证 Python 3 的版本信息python3 --version

期待输出:

Python 3.10.12

版本号和你安装的一致,就说明装对了。

# 进入 Python 交互式解释器,验证是否可以正常运行python3

期待输出:

Python 3.10.12 (main, Nov 20202315:14:05) [GCC 11.4.0] on linuxType "help""copyright""credits"or"license"for more information.>>>

出现 >>> 提示符就说明解释器正常运行。随便输入一条 Python 代码测试:

>>> print("Hello, Python!")Hello, Python!>>> exit()

exit() 退出解释器,回到 Shell。

6.2 验证 Python 路径和模块

# 确认 python3 命令指向哪个可执行文件which python3# 查看 Python 的完整编译信息python3 -c "import sys; print(sys.version)"# 查看 Python 的模块搜索路径(对调试 import 问题很有用)python3 -c "import sys; print('\n'.join(sys.path))"

期待输出(sys.path):

/usr/lib/python310.zip/usr/lib/python3.10/usr/lib/python3.10/lib-dynload/usr/local/lib/python3.10/dist-packages/usr/lib/python3/dist-packages

7. pip 的安装与配置(换源提速)

pip 是 Python 的包管理工具,地位相当于 Linux 里的 apt/yum。国内直接用 pip 安装包很慢甚至超时,换个国内镜像源是必须的操作。

7.1 验证 pip 是否正常

# 查看 pip 版本pip3 --version

期待输出:

pip 22.0.2from /usr/lib/python3/dist-packages/pip (python 3.10)

看到版本号就说明 pip 正常。如果提示 command not found:

# 手动安装 pip(Debian/Ubuntu)sudo apt install python3-pip -y# 手动安装 pip(CentOS/RHEL/Fedora)sudo dnf install python3-pip -y# 或者通过 ensurepip 安装(通用方法)python3 -m ensurepip --upgrade

7.2 升级 pip 到最新版本

# 把 pip 自身升级到最新版# 用 python3 -m pip 而不是直接用 pip3,更稳定python3 -m pip install --upgrade pip

期待输出:

Requirement already satisfied: pip in /usr/lib/python3/dist-packages (22.0.2)Collecting pip  Downloading pip-24.0-py3-none-any.whl.metadata (3.6 kB)...Successfully installed pip-24.0

7.3 配置国内镜像源(永久生效)

pip 默认从 PyPI 下载包,国内访问极慢,建议配置阿里云或腾讯云镜像。

方法一:命令行一键配置(推荐)

# 配置阿里云镜像源,永久生效# 这个命令会自动在 ~/.config/pip/pip.conf 或 ~/.pip/pip.conf 中写入配置pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/# 同时设置信任的主机(避免 HTTPS 证书问题)pip3 config set global.trusted-host mirrors.aliyun.com

期待输出:

Writing to /home/ubuntu/.config/pip/pip.conf

方法二:手动编辑配置文件

# 创建 pip 配置目录(如果不存在)mkdir -p ~/.config/pip# 创建或编辑配置文件nano ~/.config/pip/pip.conf

在文件中写入以下内容:

[global]index-url = https://mirrors.aliyun.com/pypi/simple/trusted-host = mirrors.aliyun.comtimeout = 120

保存后退出(Nano 编辑器按 Ctrl+X,然后按 Y,再按 Enter)。

可用的国内镜像源列表:

镜像名称
地址
阿里云
https://mirrors.aliyun.com/pypi/simple/
腾讯云
https://mirrors.cloud.tencent.com/pypi/simple/
清华大学
https://pypi.tuna.tsinghua.edu.cn/simple/
中科大
https://pypi.mirrors.ustc.edu.cn/simple/

7.4 验证镜像源配置

# 查看 pip 当前的完整配置pip3 config list# 用 pip 安装一个小包测试速度,-v 参数显示详细下载信息pip3 install requests -v

pip3 config list 期待输出:

global.index-url='https://mirrors.aliyun.com/pypi/simple/'global.trusted-host='mirrors.aliyun.com'

8. 虚拟环境的创建与使用

这一块非常重要,很多初学者跳过虚拟环境,把所有包都装到系统 Python 里,等项目多了就乱套了。强烈建议每个项目使用独立的虚拟环境。

8.1 创建虚拟环境

# 在当前目录下创建名为 venv 的虚拟环境# python3 -m venv 是调用 venv 模块,<目录名> 是虚拟环境的目录名,可以自定义python3 -m venv venv# 也可以指定绝对路径python3 -m venv /home/ubuntu/myproject/venv

期待输出:(没有输出就说明创建成功,venv 目录被创建在当前位置)

# 确认目录已创建ls venv/

期待输出:

binincludeliblib64pyvenv.cfg

8.2 激活虚拟环境

# 激活虚拟环境(Linux / macOS 通用)source venv/bin/activate

激活后期待输出(注意命令行提示符变化):

(venv) ubuntu@hostname:~/myproject$

提示符前多了 (venv) 标识,说明虚拟环境已激活。此时 pythonpip 命令都指向虚拟环境里的版本,和系统 Python 完全隔离。

# 验证虚拟环境中的 Python 路径which python

期待输出:

/home/ubuntu/myproject/venv/bin/python

路径在 venv 目录下,说明隔离成功。

8.3 在虚拟环境中安装包

# 激活虚拟环境后,直接用 pip 安装(不需要 sudo)pip install requestspip install flaskpip install numpy pandas

8.4 退出虚拟环境

# 退出虚拟环境,回到系统环境deactivate

退出后期待变化:

ubuntu@hostname:~/myproject$

(venv) 标识消失,说明已退出虚拟环境。

8.5 导出和重建依赖

# 在虚拟环境中,导出所有已安装的包及其版本pip freeze > requirements.txt# 查看生成的文件cat requirements.txt

期待输出:

certifi==2024.2.2charset-normalizer==3.3.2idna==3.6requests==2.31.0urllib3==2.2.0
# 在新环境中根据 requirements.txt 重建所有依赖pip install -r requirements.txt

9. 卸载 Python 的正确姿势

有时候你可能需要卸载通过包管理器安装的 Python(比如要换版本,或者清理旧版本)。注意:不要卸载系统默认的 Python,可能会导致系统工具异常。

9.1 卸载 Python(Debian/Ubuntu)

# 先确认要卸载的版本,避免误删python3 --version# 卸载 Python 3.12(如果你装的是通过 deadsnakes 安装的特定版本)# 把 3.12 换成你实际要卸载的版本sudo apt remove python3.12 -y# 卸载不再需要的相关依赖sudo apt autoremove -y# 清理残留配置文件(purge 比 remove 更彻底)sudo apt purge python3.12 -y

期待输出:

Readingpackagelists... DoneBuildingdependencytree... DoneReadingstateinformation... DoneThefollowingpackageswillbeREMOVED:python3.12python3.12-devpython3.12-venv...upgraded, 0 newlyinstalled, 3 toremoveand 0 notupgraded.Afterthisoperation, 75.3MBdiskspacewillbefreed.(Readingdatabase ... 95483 filesanddirectoriescurrentlyinstalled.)Removingpython3.12 (3.12.2-1+jammy1) ...

9.2 卸载 Python(CentOS/RHEL)

# 查看通过 yum/dnf 安装的 Python 包rpm -qa | grep python# 卸载指定版本(谨慎操作)sudo yum remove python3 -y# 或者 dnfsudo dnf remove python3 -y

9.3 卸载 pip 安装的第三方包

# 卸载某个具体的包pip3 uninstall requests -y# 卸载虚拟环境中的所有包(先激活虚拟环境)pip freeze | xargs pip uninstall -y

9.4 删除虚拟环境

虚拟环境就是一个普通目录,直接删掉就行:

# 先退出虚拟环境(如果已激活)deactivate# 删除虚拟环境目录rm -rf venv/

10. 常见问题 Q&A

Q1:apt update 时提示 "Unable to connect" 或 "Failed to fetch"

原因:网络不通,或者软件仓库地址不可达。

解决方案

# 1. 先检查网络连通性ping -c 4 8.8.8.8# 2. 检查 DNS 解析是否正常nslookup archive.ubuntu.com# 3. 如果是国内服务器,考虑换国内镜像源(以阿里云为例)sudo sed -i 's|http://archive.ubuntu.com/ubuntu|https://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list# 4. 替换后重新 updatesudo apt update

Q2:安装 Python 后,`python3` 命令找不到(command not found)

原因:安装路径不在 PATH 环境变量里,或者安装实际上失败了。

解决方案

# 1. 先确认安装是否成功which python3find / -name "python3" 2>/dev/null# 2. 如果找到了,查看 PATHecho$PATH# 3. 把 Python 所在路径加入 PATH(临时)export PATH=$PATH:/usr/bin# 4. 永久生效:写入 ~/.bashrcecho'export PATH=$PATH:/usr/bin' >> ~/.bashrcsource ~/.bashrc

Q3:pip install 时提示 "Could not fetch URL" 或下载超时

原因:PyPI 官方源在国内访问慢或不稳定。

解决方案

# 临时使用国内镜像源(-i 参数指定临时源)pip3 install 包名 -i https://mirrors.aliyun.com/pypi/simple/# 永久换源(参考第 7 节)pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/

Q4:安装某些包时提示 "error: command 'gcc' failed"

原因:缺少编译工具,某些包有 C 扩展,需要 gcc 编译器。

解决方案

# Ubuntu/Debiansudo apt install build-essential python3-dev -y# CentOS/RHEL/Fedorasudo dnf groupinstall "Development Tools" -ysudo dnf install python3-devel -y

Q5:pip 提示 "WARNING: Running pip as the 'root' user can result in broken permissions"

原因:在 root 用户下直接运行 pip 可能破坏系统包的权限设置。

解决方案

# 推荐做法一:使用虚拟环境(最佳实践)python3 -m venv venvsource venv/bin/activatepip install 包名  # 不需要 sudo# 推荐做法二:安装到用户目录(不影响系统)pip3 install --user 包名# 如果非要用 root,加 --break-system-packages 参数(Python 3.11+ 的要求)sudo pip3 install 包名 --break-system-packages

Q6:系统里有 Python 3.10 和 Python 3.12,想默认用 3.12

解决方案

# 注册两个版本到 update-alternativessudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 2# 交互式选择默认版本sudo update-alternatives --config python3

期待交互界面:

There are 2 choices for the alternative python3 (providing /usr/bin/python3).  Selection    Path                    Priority   Status------------------------------------------------------------0            /usr/bin/python3.122         auto mode1            /usr/bin/python3.101         manual mode2            /usr/bin/python3.122         manual modePress <enter> to keep the current choice[*], ortype selection number:

输入 2 后按 Enter,以后 python3 就默认使用 3.12。


Q7:pip3 和 pip 的区别是什么?

简单说,在 Python 3 环境下,pip3 和 pip 通常是同一个工具,只是命令名不同。

  • pip3
     明确对应 Python 3 的 pip,不会和 Python 2 的 pip 混淆。
  • pip
     在不同系统上可能指向 Python 2 或 Python 3 的 pip,取决于系统配置。

最佳实践:使用 python3 -m pip 代替 pip3,这样可以确保 pip 和 python3 是同一个解释器配套的:

python3 -m pip install 包名python3 -m pip --version

11. 小总结

回顾一下这篇教程覆盖的内容:

安装前,先确认发行版类型(cat /etc/os-release),确认系统里有没有 Python(python3 --version),再根据需求决定要不要装、装什么版本。

安装过程,根据发行版选对应的包管理器:

  • Debian/Ubuntu/Mint → apt,需要更新版本用 deadsnakes PPA
  • CentOS 7 / RHEL 7 → yum,需要更高版本用 SCL
  • CentOS 8+ / Fedora / RHEL 8+ → dnf

安装后,用 python3 --version 和 python3 -c "print('OK')" 验证安装是否成功,pip 记得换成国内镜像源,项目开发时用虚拟环境隔离依赖。

最新最全的的内容在永久域名 itinstall.dev ,可以收藏备用。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-04-14 18:23:13 HTTP/2.0 GET : https://f.mffb.com.cn/a/486326.html
  2. 运行时间 : 0.121441s [ 吞吐率:8.23req/s ] 内存消耗:4,962.05kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=0c2cc39ce01175f7c88f9d4e22b9a2a1
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000556s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000639s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000299s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.005764s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000680s ]
  6. SELECT * FROM `set` [ RunTime:0.001751s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000565s ]
  8. SELECT * FROM `article` WHERE `id` = 486326 LIMIT 1 [ RunTime:0.000482s ]
  9. UPDATE `article` SET `lasttime` = 1776162193 WHERE `id` = 486326 [ RunTime:0.008123s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000261s ]
  11. SELECT * FROM `article` WHERE `id` < 486326 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000484s ]
  12. SELECT * FROM `article` WHERE `id` > 486326 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.012800s ]
  13. SELECT * FROM `article` WHERE `id` < 486326 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.008188s ]
  14. SELECT * FROM `article` WHERE `id` < 486326 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.010813s ]
  15. SELECT * FROM `article` WHERE `id` < 486326 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.000931s ]
0.123130s