如何在外部管理环境中安装Python包?尝试使用apt install进行系统范围的安装

It seems like you are trying to install a Python package in an externally-managed environment. This error message usually occurs when you are trying to install a package system-wide, but the environment is managed by an external tool or package manager. In this case, you can try installing the package using the following command:

sudo apt install python3-<package-name>

Replace <package-name> with the name of the package you are trying to install. This command should install the package system-wide and make it available to all users on the system.

If you wish to install a non-Debian-packaged Python package, you can create a virtual environment using the following command:

python3 -m venv path/to/venv

This will create a new virtual environment in the specified directory. You can then activate the environment and install packages using pip as usual.

参考文档
(1) How do I install a pip package globally instead of locally?. https://stackoverflow.com/questions/36936212/how-do-i-install-a-pip-package-globally-instead-of-locally.
(2) Ubuntu 中 Pip 的外部管理环境错误. https://cn.linux-console.net/?p=17687.
(3) Pip install and Python’s externally managed | Kali Linux Blog. https://www.kali.org/blog/python-externally-managed/.
(4) Installing Packages – Python Packaging User Guide. https://packaging.python.org/tutorials/installing-packages/.
(5) undefined. https://stackoverflow.com/a/43623102/.

物联沃分享整理
物联沃-IOTWORD物联网 » 如何在外部管理环境中安装Python包?尝试使用apt install进行系统范围的安装

发表评论