aboutsummaryrefslogtreecommitdiff
path: root/docs/applications
diff options
context:
space:
mode:
authorat2er <xb0515@outlook.com>2026-08-15 06:13:38 +0000
committerat2er <xb0515@outlook.com>2026-08-15 06:13:38 +0000
commitc9a2942ac34e94ee873ed57e29e011a67bc3d9c4 (patch)
tree2a04cb9012ccf1b2ca0181447cb7c45c62f114fb /docs/applications
parentfeat(python.md): 'python-is-python3' (diff)
revert(python): library
Diffstat (limited to 'docs/applications')
-rw-r--r--docs/applications/programming/python.md34
1 files changed, 34 insertions, 0 deletions
diff --git a/docs/applications/programming/python.md b/docs/applications/programming/python.md
index 6629a08..29ad315 100644
--- a/docs/applications/programming/python.md
+++ b/docs/applications/programming/python.md
@@ -20,3 +20,37 @@ Linux里面一般以`python3`命令使用Python。
- Debian: `sudo apt install python-is-python3 -y`
- Fedora: `sudo dnf install python-is-python3 -y`
+
+## 库
+
+Python拥有规模庞大的PyPi库。通常,我们使用`pip`进行安装。但在Linux下,`pip`不一定会随着Python预装,因此需要使用包管理器安装。
+
+- Debian: `sudo apt install python3-pip`
+- Fedora: `sudo dnf install python3-pip`
+- Arch: `sudo pacman -S python-pip`
+
+!!! warning "系统依赖"
+ 使用Pip安装部分库时,可能会出现如下警告:
+ ```
+ error: externally-managed-environment
+
+ × This environment is externally managed
+ ╰─> To install Python packages system-wide, try 'pacman -S
+ python-xyz', where xyz is the package you are trying to
+ install.
+
+ If you wish to install a non-Arch-packaged Python package,
+ create a virtual environment using 'python -m venv path/to/venv'.
+ Then use path/to/venv/bin/python and path/to/venv/bin/pip.
+
+ If you wish to install a non-Arch packaged Python application,
+ it may be easiest to use 'pipx install xyz', which will manage a
+ virtual environment for you. Make sure you have python-pipx
+ installed via pacman.
+
+ note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
+ hint: See PEP 668 for the detailed specification.
+ ```
+ 由于系统的部分组件依赖Python的依赖,因而外来库可能破坏系统本身的依赖关系。
+
+ 这个时候,我们建议您使用`venv`创建虚拟环境,或者寻找发行版的软件源是否有对应的库可供安装(一般包名为`python3-库`或`python-库`)。