root@jmk:/data/git/gitee/ddns# pip3 install -r requirements.txt
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
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.
只需要配置下面的参数即可
echo -e "[global]\nbreak-system-packages = true" > /etc/pip.conf
效果如下
root@jmk:/data/git/gitee/ddns# cat /etc/pip.conf
[global]
break-system-packages = true
root@jmk:/data/git/gitee/ddns# pip3 install -r requirements.txt
Looking in indexes: https://mirrors.cloud.tencent.com/pypi/simple
Collecting plbm_liuyi778_Stable==1.3.6
Downloading https://mirrors.cloud.tencent.com/pypi/packages/8b/3d/e73e4d22aa41621f850cb3a5353f7744e68f478adfe43110003aa55812ca/plbm_liuyi778_stable-1.3.6-py3-none-any.whl (43 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.6/43.6 kB 6.2 MB/s eta 0:00:00
Collecting Requests==2.31.0
Downloading https://mirrors.cloud.tencent.com/pypi/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 kB 21.8 MB/s eta 0:00:00
Collecting tencentcloud_sdk_python==3.0.943
Downloading https://mirrors.cloud.tencent.com/pypi/packages/21/74/f9453f70aaa1e2a1246b1f2fd19884023813df43726977eb4b9ac38368ab/tencentcloud_sdk_python-3.0.943-py2.py3-none-any.whl (8.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.4/8.4 MB 30.5 MB/s eta 0:00:00
Collecting loguru~=0.7.0
Downloading https://mirrors.cloud.tencent.com/pypi/packages/03/0a/4f6fed21aa246c6b49b561ca55facacc2a44b87d65b8b92362a8e99ba202/loguru-0.7.2-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.5/62.5 kB 452.4 kB/s eta 0:00:00
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/lib/python3/dist-packages (from Requests==2.31.0->-r requirements.txt (line 2)) (3.0.1)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from Requests==2.31.0->-r requirements.txt (line 2)) (3.3)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/lib/python3/dist-packages (from Requests==2.31.0->-r requirements.txt (line 2)) (1.26.12)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from Requests==2.31.0->-r requirements.txt (line 2)) (2022.9.24)
Installing collected packages: Requests, plbm_liuyi778_Stable, loguru, tencentcloud_sdk_python
Attempting uninstall: Requests
Found existing installation: requests 2.28.1
Not uninstalling requests at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'requests'. No files were found to uninstall.
Successfully installed Requests-2.31.0 loguru-0.7.2 plbm_liuyi778_Stable-1.3.6 tencentcloud_sdk_python-3.0.943
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv