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

Ubuntu 14.04升级aws-sam-cli至0.3.0失败问题求助

Fixing AWS SAM CLI Upgrade Error (0.2.11 → 0.3.0) on Ubuntu 14.04

Hey there, let's break down why you're hitting that error and how to fix it quickly.

What's Causing the Error?

The root issues here are two-fold:

  1. Ubuntu 14.04 ships with Python 2.7 and an outdated version of pip that doesn't recognize modern package configuration options like python_requires—which AWS SAM CLI 0.3.0 uses in its setup.
  2. Even more importantly, AWS SAM CLI dropped support for Python 2.7 a while back. Your current Python 2.7 environment simply isn't compatible with SAM CLI 0.3.0 or newer versions.

Step-by-Step Fixes

1. Install Python 3.6+ (Ubuntu 14.04 Needs a Third-Party PPA)

Ubuntu 14.04's default Python 3 version is 3.4, which is too old for SAM CLI. We'll add a trusted PPA to get Python 3.6:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6 python3.6-dev

2. Set Up Pip for Python 3.6

Next, install and upgrade pip specifically for Python 3.6 (since the system pip is tied to Python 2.7):

curl https://bootstrap.pypa.io/pip/3.6/get-pip.py | sudo python3.6

3. Install/Upgrade SAM CLI with Python 3.6's Pip

Now use the updated Python 3.6 environment to install the SAM CLI version you want:

pip3.6 install --user --upgrade aws-sam-cli

4. Make the sam Command Accessible

Add the user-specific Python 3.6 bin directory to your system PATH so you can run sam from anywhere:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

5. Verify the Upgrade

Check that everything worked by running:

sam --version

You should see 0.3.0 (or a newer version if one's available) printed out.

Alternative: Use a Virtual Environment (If You Don't Want to System-Wide Upgrade)

If you prefer not to change your system's default Python setup, use a virtual environment to isolate the SAM CLI installation:

# Install virtualenv first
sudo apt-get install virtualenv
# Create a Python 3.6 virtual environment named sam-env
virtualenv -p python3.6 sam-env
# Activate the environment
source sam-env/bin/activate
# Install SAM CLI inside the environment
pip install --upgrade aws-sam-cli
# Check the version
sam --version
# When you're done, exit the environment with:
# deactivate

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.29 08:57:24