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

Kudu Console中SSH与Bash安装Python(3.x)包的差异分析

SSH vs. Kudu Bash Console for Python Package Installation in Kudu

Great question! This is a common gotcha with Azure App Service's Kudu tooling, since the two environments behave surprisingly differently even though they're both part of Kudu. Let's break this down:

Core Differences Between SSH and Kudu Bash

  • User & Environment Isolation
    SSH connects you directly to your App Service's application user context—this is the same user that runs your web app. The Kudu built-in Bash console, however, runs under the Kudu service's system user instead. These are two separate security contexts, so their environment variables (like PATH, PYTHONPATH) and available resources are completely isolated.

  • Python Environment Paths
    In an SSH session, you're using the Python interpreter tied to your web app: this could be a virtual environment you set up in /home/site/wwwroot, or the user-level Python installed in /home/.local/bin. The Kudu Bash console uses a global Python instance that's part of the Kudu service itself, which lives outside your app's directory structure and isn't shared with your site.

  • Package Installation Locations
    When you run pip install via SSH, packages are installed to your app user's Python environment (e.g., venv/lib/pythonX.X/site-packages or /home/.local/lib/pythonX.X/site-packages). Packages installed in Kudu Bash go to the Kudu service's global Python directories, which your web app can't access—and vice versa.

Why pip list in Bash Doesn't Show SSH-Installed Packages

This boils down to using completely separate Python environments. To confirm this, run these commands in both contexts:

  • In SSH: which python and which pip — you'll see paths pointing to your app's Python (e.g., /home/site/wwwroot/venv/bin/pip)
  • In Kudu Bash: which python and which pip — you'll get paths to Kudu's global Python (e.g., /usr/bin/pip)

Since each pip command is tied to a different interpreter, they only show packages installed in their respective environments. If you want to see SSH-installed packages from Kudu Bash, you need to explicitly call your app's pip executable, like:

/home/site/wwwroot/venv/bin/pip list
# Or if no virtual environment:
/home/.local/bin/pip list

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.09 15:12:28