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

使用Jetson Ansible Playbook配置Xavier时python-pip安装报错求助

问题:使用Jetson Ansible Playbook配置NVIDIA Xavier时python-pip安装失败

我尝试使用Jetson Ansible Playbook配置NVIDIA Xavier,执行命令ansible-playbook -kK -i targets -l NVIDIA jetson_install.yml时,在「Install python and aptitude」任务中失败,报错提示“Package 'python-pip' has no installation candidate”,且说明该包已被python3-pip替代。我已执行sudo apt install python3-pip安装了Python3的pip,但问题依旧,求解决办法。

报错详情

BECOME password[defaults to SSH password]: 
Enter your Bitbucket username:
Enter your Bitbucket password: 

PLAY [Install NVIDIA Xavier] ******************************************************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************************************************************************
Enter passphrase for key '/home/xavier/.ssh/id_rsa': 
[DEPRECATION WARNING]: Distribution Ubuntu 20.04 on host localhost should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with prior Ansible releases. A future Ansible 
release will default to using the discovered platform python for this host. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information. This feature 
will be removed in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
ok: [localhost]

TASK [Install python and aptitude] ************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "msg": "non-zero return code", "rc": 100, "stderr": "Shared connection to localhost closed.\r\n", "stderr_lines": ["Shared connection to localhost closed."], "stdout": "\r\n\rReading package lists... 0%\r\rReading package lists... 100%\r\rReading package lists... Done\r\n\rBuilding dependency tree... 0%\r\rBuilding dependency tree... 0%\r\rBuilding dependency tree... 50%\r\rBuilding dependency tree... 50%\r\rBuilding dependency tree       \r\n\rReading state information... 0%\r\rReading state information... 0%\r\rReading state information... Done\r\nPackage python-pip is not available, but is referred to by another package.\r\nThis may mean that the package is missing, has been obsoleted, or\r\nis only available from another source\r\nHowever, the following packages replace it:\r\n  python3-pip\r\n\r\nE: Package 'python-pip' has no installation candidate\r\n", "stdout_lines": ["", "", "Reading package lists... 0%", "", "Reading package lists... 100%", "", "Reading package lists... Done", "", "", "Building dependency tree... 0%", "", "Building dependency tree... 0%", "", "Building dependency tree... 50%", "", "Building dependency tree... 50%", "", "Building dependency tree       ", "", "", "Reading state information... 0%", "", "Reading state information... 0%", "", "Reading state information... Done", "", "Package python-pip is not available, but is referred to by another package.", "This may mean that the package is missing, has been obsoleted, or", "is only available from another source", "However, the following packages replace it:", "  python3-pip", "", "E: Package 'python-pip' has no installation candidate"]}

PLAY RECAP ************************************************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  

解决方法

1. 修改Playbook中的安装任务

打开jetson_install.yml,找到「Install python and aptitude」任务,将其中的python-pip替换为python3-pip,同时建议把python(对应Python2)替换为python3——因为Ubuntu 20.04已不再默认预装Python2。修改后的任务示例:

- name: Install python and aptitude
  apt:
    name:
      - python3
      - python3-pip
      - aptitude
    state: present
    update_cache: yes

2. 指定Ansible使用Python3解释器

从报错的Deprecation警告可知,Ubuntu 20.04应使用/usr/bin/python3作为Python解释器,可通过以下两种方式配置:

  • 在inventory文件中指定:打开targets文件,给NVIDIA主机添加解释器变量:
    NVIDIA ansible_python_interpreter=/usr/bin/python3
    
  • 全局配置:修改ansible.cfg(若无则在当前目录创建),添加如下内容:
    [defaults]
    interpreter_python = auto_silent
    

3. 重新执行Playbook

先更新系统apt缓存:

sudo apt update

再重新运行Playbook命令:

ansible-playbook -kK -i targets -l NVIDIA jetson_install.yml

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.16 23:30:57