En este tutorial rápido vamos a configurar python en un mac os x con el fin de ejecutar ansible de la carpeta actual.
Python en un mac ya está instalado. Sin embargo, es la versión 2 y queremos la versión 3. Instalaremos un nuevo pitón con "brew". Usted tiene que tener `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)"Entonces, puede instalar python3 como así:
brew install python
which python3
python3 -m pip install --user --upgrade pip
python3 -m pip --versionFinalmente, crear un venv en la carpeta actual y activarlo:
cd
python3 -m venv zenv
## or:
python3 -m venv zenv_with_a_more_specific_name
## then:
. zenv/bin/activateDado todo esto, su cáscara estará ejecutando una versión local de python con versiones locales de todos los paquetes. ¡Disfruta! Para dejar el venv, escriba el siguiente 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.