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

Ubuntu 20.04安装Xilinx Petalinux遇Python版本及依赖报错求助

Fixing Petalinux Installation Error with Python 2.7 on Ubuntu 20.04

I’ve run into this exact issue before with Ubuntu 20.04—since it doesn’t ship with a default python symlink pointing to Python 2.7, Petalinux can’t detect the required version even if you’ve installed Python 2.7 already. Here’s how to resolve it step by step:

Step 1: Install Python 2.7 and its dependencies

First, make sure Python 2.7 is properly installed along with development tools:

sudo apt update
sudo apt install python2.7 python2.7-dev

Step 2: Set up pip2 (optional but useful)

If you need pip for Python 2.7 to manage additional dependencies, install it using the legacy bootstrap script:

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python2.7 get-pip.py

Ubuntu 20.04 uses python3 as the default, so we need to explicitly map the python command to Python 2.7 using update-alternatives (this is cleaner than manual symlinks):

# Add Python 2.7 to the alternatives list
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
# Add Python 3 (default) to the list (lets you switch back later if needed)
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2

Then run this command to select Python 2.7 as the default:

sudo update-alternatives --config python

You’ll see a prompt similar to this—just enter the number corresponding to Python 2.7:

There are 2 choices for the alternative python (providing /usr/bin/python).

Selection Path Priority Status

  • 0 /usr/bin/python3.8 2 auto mode
    1 /usr/bin/python2.7 1 manual mode

Press to keep the current choice[*], or type selection number: 1

Step 4: Verify the Python version

Check that the python command now points to the correct version:

python --version

You should see output like Python 2.7.18 (or a similar patch version).

Step 5: Install all required Petalinux dependencies

Don’t forget to install the full set of packages Petalinux needs to avoid other installation errors:

sudo apt install build-essential git make net-tools libncurses5-dev tftpd zlib1g-dev libssl-dev flex bison libselinux1 gnupg wget diffstat chrpath socat xterm autoconf libtool tar unzip texinfo zlib1g-dev gcc-multilib automake zlib1g:i386 screen pax gawk python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 cpio

After completing these steps, your Petalinux installation should recognize the Python 2.7 version and proceed without the error you encountered.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.08 14:32:47