You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

marimo自动切换至全局Python而非uv虚拟环境的问题求助

解决uv环境中运行marimo切换到全局Python的问题
  • 确保marimo安装在项目venv内
    不要全局安装marimo,而是在项目目录下执行:

    uv add marimo
    

    也可以把marimo添加到pyproject.toml的依赖列表中,执行uv sync自动安装:

    [project]
    name = "govenance-data"
    version = "0.1.0"
    description = "Add your description here"
    readme = "README.md"
    requires-python = ">=3.11"
    dependencies = [
        "xlsxwriter>=3.2.5",
        "marimo>=0.6.0"
    ]
    
  • 用uv run直接执行marimo
    无需手动激活venv,直接通过uv指定环境运行:

    uv run marimo
    

    这个命令会强制使用当前项目的uv venv环境,避免路径冲突。

  • 手动激活venv后运行
    激活uv创建的虚拟环境:

    • Linux/macOS:
      source .venv/bin/activate
      
    • Windows:
      .venv\Scripts\activate
      

    激活后执行marimo,或者直接调用venv内的Python模块:

    python -m marimo
    
  • 验证环境正确性
    激活venv后,检查当前Python路径:

    • Linux/macOS:
      which python
      
    • Windows:
      where python
      

    输出应指向项目目录下的.venv/bin/python(或Windows对应路径),确认后再运行marimo。

内容的提问来源于stack exchange,提问作者iFunction

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 20:34:59