无法从 Ubuntu 中安装的包导入 python 模块

问题描述 投票:0回答:1

在说问题之前,我无法在ubuntu中直接使用pip,我必须先设置一个python虚拟环境。每当我在环境之外执行此操作时,我都会收到此消息:

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.12/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.

我使用 pip 安装了一个名为 mamba-ssm 的软件包。我正在使用命令行运行一个 python 脚本,该脚本从 mamba ssm 导入模块,如下所示:

`from mamba_ssm.ops.triton.ssd_combined import mamba_chunk_scan_combined`

但是当我运行脚本时,我收到此错误消息:

ModuleNotFoundError: No module named mamba_ssm.ops.triton.ssd_combined

但是当我在终端中运行 python 并导入模块时,它会被导入。

我尝试过:

export PYTHONPATH=home/fadia/splice/lib/python3.12/site-packages/mamba_ssm:$PYTHONPATH
然后运行我的代码。

我尝试使用我创建的 venv 的 python 执行代码:

/home/venv/bin/python

from mamba_ssm.ops.triton.ssd_combined import mamba_chunk_scan_combined
添加到 __init__py

没有任何作用。

python ubuntu import virtualenv
1个回答
0
投票

您是否尝试过直接在虚拟环境中克隆mamba

© www.soinside.com 2019 - 2024. All rights reserved.