简体   繁体   English

vagrant 在 Mac OS Monterey 上找不到 ansible

[英]vagrant cannot find ansible on Mac OS Monterey

I have a new MacBook running OS Monterey and I'm trying to install a project in vagrant. I have a completely clean install of the OS and I've downloaded the resources from GitHub. I previously had an identical copy running on an old machine.我有一台运行 OS Monterey 的新 MacBook,我正在尝试在 vagrant 中安装一个项目。我完全干净地安装了操作系统,并且我已经从 GitHub 下载了资源。我之前在一台旧机器上运行了一个相同的副本. I installed ansible locally using the recommended我使用推荐的方式在本地安装了 ansible

python3 -m pip install --user ansible

pip3 show ansible tells me that ansible 5.2.0 is installed in /Users/this_user/Library/Python/3.8/lib/python/site-packages pip3 show ansible告诉我ansible 5.2.0安装在/Users/this_user/Library/Python/3.8/lib/python/site-packages

When I run vagrant up vagrant imports the Virtualbox bento/ubuntu-20.04 but when it gets to provisioning it fails, first with当我运行vagrant up vagrant 导入 Virtualbox bento/ubuntu-20.04但是当它开始配置时失败,首先是

vagrant gathered an unknown Ansible version

And falls back on compatibility mode 1.8并退回到兼容模式1.8

And then:接着:

The Ansible software could not be found!

I tried the suggestion of adding /Users/this_user/Library/Python/3.8/lib/python/site-packages to $PATH but this did not solve the problem.我尝试了将/Users/this_user/Library/Python/3.8/lib/python/site-packages添加到$PATH的建议,但这并没有解决问题。

ansible --version` results in `ansible: command not found

I'm running the latest Vagrant, 2.2.19 .我正在运行最新的Vagrant, 2.2.19

I uninstalled with python3 -m pip install ansible我用python3 -m pip install ansible
then installed with Homebrew, brew install ansible然后用 Homebrew 安装, brew install ansible
This solved the problem.这解决了问题。

Using Virtualenv solved my problem:使用Virtualenv解决了我的问题:

I uninstalled ansible:我卸载了 ansible:

python3 -m pip install ansible

Create virtualenv:创建虚拟环境:

virtualenv myenv -p python3
source myenv/bin/activate

Then install ansible:然后安装ansible:

pip3 install ansible

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM