Neste tutorial rápido, vamos configurar o python em um mac os x para executar o ansble na pasta atual.
Python em um mac já está instalado. No entanto, é a versão 2 e queremos a versão 3. Instalaremos uma nova python com 'brew'. Você tem que ter `brew` instalado:
brew --version
## install brew if you haven't already:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Então, você pode instalar python3 assim:
brew install python
which python3
python3 -m pip install --user --upgrade pip
python3 -m pip --versionFinalmente, crie um venv na pasta atual e ative-o:
cd
python3 -m venv zenv
## or:
python3 -m venv zenv_with_a_more_specific_name
## then:
. zenv/bin/activateDado tudo isto, o seu shell irá executar uma versão local do python com versões locais de todos os pacotes. Aproveitem! Para sair do venv, digite o seguinte comando:
deactivate.^.
comments
Please login to post comments:Frankly, automating Python venvs for something as lightweight as running a few Ansible commands is overengineering. Most Ansible tasks don’t benefit from Python isolation and work perfectly well with system-level packages — the added complexity often just gets in the way.