Ubuntu之前安装了ansible,卸载之后在安装报错

sudo apt install ansible
The following information may help to resolve the situation:

The following packages have unmet dependencies:
python3-crypto : Depends: python3 (< 3.9) but 3.10.6-1~22.04 is to be installed
E: Unable to correct problems, you have held broken packages.

请参考下面的方法,如果还可以还请 采纳:
错误信息提示你的 python3 版本太高,需要更低版本,但实际上你安装的是3.10.6-1~22.04,而 python3-crypto 包需要更低版本(< 3.9)。

可以尝试使用更低版本的 python3 来安装 ansible,如:

sudo apt install python3=3.8
sudo apt install ansible

或者使用 virtualenv 创建一个更低版本的 python 环境来安装 ansible:

sudo apt install python3-virtualenv
virtualenv -p python3.8 venv
source venv/bin/activate
pip install ansible