使用“brew install ansible”命令无法完美安装 ansible 在 MacOS 中不起作用?错误:-sh:/usr/local/bin/ansible:没有那个文件或目录

Par*_*kum 5 python macos homebrew ansible

我尝试使用终端 ( brew) 以及使用.dmgpackage.json安装 Python 。

command: brew install python
and this path is python when install using dmg
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3
Run Code Online (Sandbox Code Playgroud)

但我收到下面列出的错误。

在此处输入图片说明

之后我尝试ansible安装:

brew install ansible
Run Code Online (Sandbox Code Playgroud)

which ansible 在此处输入图片说明

最后一个 ansible 命令 ping for all 或 host : 在此处输入图片说明

这是特定于操作系统的问题还是其他问题?您的帮助将不胜感激。

Yas*_*sen 3

如果brew,则检查您的brew版本...

如果您确实需要brew install,请检查更新。macOS 10.13.6 上有一个已知问题 #5021 。#5019修复了它。

...但我建议使用pip install

由于ansible取决于python,我强烈建议使用安装python应用程序的常见方式:

pip3 install ansible 
Run Code Online (Sandbox Code Playgroud)

或者,来自存储库:

git clone https://github.com/ansible/ansible.git
cd ansible
pip3 install -r requirements.txt
python3 setup.py install
Run Code Online (Sandbox Code Playgroud)

brew警告

屏幕截图警告说:

ansible已经安装了,只是没有链接

所以,你可以尝试

brew unlink ansible
sudo chown -R $USER:admin /usr/local/bin /usr/local/etc /usr/local/sbin /usr/local/share
brew link  --overwrite ansible
Run Code Online (Sandbox Code Playgroud)

如果没有帮助:

brew doctor
Run Code Online (Sandbox Code Playgroud)