Configuración de un espacio de trabajo virtual de Python#
To create a Python virtual environment using venv
, ensure that Python is installed on your system. You can download the installer from python.org. The AIM WebSocket API requires Python 3.8 or later.
En Windows, asegúrese de marcar la opción Agregar Python 3.x a PATH durante la instalación. Esto podría requerir privilegios de administrador.
En macOS y la mayoría de las distribuciones de Linux, Python 3 suele estar preinstalado, pero aun así es una buena idea verificar la versión.
1. Create the Virtual Environment#
From within the root directory of the clone repository, run the following:
python -m venv venv
2. Activate the Virtual Environment#
From within the root directory of the clone repository, run the appropriate command for your operating system:
Ventanas#
PowerShell o Símbolo del sistema:
venv\Scripts\activate
Git Bash (MINGW64) - no recomendado:
source venv/Scripts/activate
macOS, Linux y WSL#
source venv/bin/activate
Note: To ensure your virtual environment is activated automatically, you can add the activation command to your shell’s startup file (e.g., .bashrc
, .zshrc
).
Verificar el entorno del shell#
Para verificar que su entorno de shell esté utilizando el entorno virtual correcto, inicie una sesión de Python ingresando el REPL:
python
Luego ejecute los siguientes comandos:
import sys
print(sys.prefix)
La salida debe coincidir con la ruta al directorio de su entorno virtual.
3. Install the Required Packages#
From within the root directory of the clone repository, run:
pip install -r requirements.txt
On macOS, if you encounter an error while installing pyaudio
, first install the portaudio
library using Homebrew, then try again:
brew install portaudio
pip install -r requirements.txt
On Debian/Ubuntu: Install portaudio19-dev
using apt, and then re-run pip install -r requirements.txt
:
sudo apt install portaudio19-dev
pip install -r requirements.txt
Ahora puedes ejecutar scripts de Python en el robot conectado.