关于 Debian12 无法使用 pip install 安装 cos- Python -sdk-v5 的问题

查看 78|回复 4
作者:joeyv2   
使用官方命令:pip install -U cos-python-sdk-v5
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.
使用:pipx install cos-python-sdk-v5
Note: Dependent package 'charset-normalizer' contains 1 apps
  - normalizer
No apps associated with package cos-python-sdk-v5. Try again with '--include-deps'
to include apps of dependent packages, which are listed above. If you are attempting
to install a library, pipx should not be used. Consider using pip or a similar tool
instead."

install, Python, you, venv

Masoud2023   
没看懂你想干什么,感觉你可能不会做 python 依赖管理。
pipx 这写的挺明白了吧:If you are attempting to install a library, pipx should not be used 。
你正确的做法应该是 python -m virtualenv .venv 创建个虚拟环境,然后在环境里装你的依赖,然后用环境的 python 运行你的程序。
wccc   
pip install -U cos-python-sdk-v5 --break-system-packages
joeyv2
OP
  
@Masoud2023 cos-python-sdk-v5 是第三方库使用 pip install 安装提示如上,返回内容中有写到第三方库可以使用 pipx install xyz 自动创建虚拟环境并安装。还是说需要先执行 python3 -m 再执行怕 pipx install
Masoud2023   
@joeyv2 #3 你能不能完整的说一下你想干什么,想做什么需求,只言片语这个我不知道接下来怎么指导,pip 行为最近新版改了,你做 python 程序不建虚拟环境肯定装不进去你项目需要用的依赖的,以前很多教程都没有提示这一点的。
您需要登录后才可以回帖 登录 | 立即注册

返回顶部