执行:
pipx install --include-deps --force "ansible==6.*"
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7d18396381f0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7d1839638400>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7d1839638610>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7d18396388b0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7d1839638a60>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
ERROR: Could not find a version that satisfies the requirement pip (from versions: none)
ERROR: No matching distribution found for pip
Failed to upgrade shared libraries
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pipx/shared_libs.py", line 113, in upgrade
subprocess_post_check(upgrade_process)
File "/usr/lib/python3/dist-packages/pipx/util.py", line 202, in subprocess_post_check
raise PipxError(
pipx.util.PipxError: '/home/bylike/.local/pipx/shared/bin/python -m pip --disable-pip-version-check
install --force-reinstall -q --upgrade pip setuptools wheel' failed
Fatal error from pip prevented installation. Full pip output in file:
/home/bylike/.local/pipx/logs/cmd_2024-11-15_20.36.35_pip_errors.log
Some possibly relevant errors from pip install:
ERROR: Could not find a version that satisfies the requirement ansible==6.* (from versions: none)
ERROR: No matching distribution found for ansible==6.*
Error installing ansible from spec 'ansible==6.*'.
1.出现网络重复尝试,可能是dns问题,执行:
sudo nano /etc/resolv.conf
填入
nameserver 8.8.8.8
nameserver 8.8.4.4
保存后,再次安装,done~
2.如果还是不行,可以换个源:
pipx install --include-deps --force --index-url https://pypi.tuna.tsinghua.edu.cn/simple "ansible==6.*"
3.如果还是提示命令不存在,需要:
pipx ensurepath
source ~/.bashrc