Prerequisites & Setup
Before you install the Truffle SDK, please ensure your environment is set up correctly. This will help avoid common issues and keep your Python projects isolated and manageable.
1. Python 3.10
- Ubuntu/Debian
- macOS
- Windows
Install build-dependences and check for Python 3.10+:
sudo apt update
sudo apt install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils
python3 --version
If you need to install Python 3.10 via apt:
sudo apt install python3.10 python3.10-venv python3.10-distutils
Install Python 3.10 via Homebrew:
brew update
brew install [email protected]
(Optional) Manage versions with pyenv:
brew install pyenv
echo 'eval "$(pyenv init --path)"' >> ~/.zshrc
source ~/.zshrc
pyenv install 3.10.13
pyenv global 3.10.13
Verify:
python3 --version
Install via Chocolatey or the official installer:
choco install python --version=3.10.0
Then verify:
python --version
2. Virtual environment
A virtual environment keeps your dependencies isolated. Run:
# Create the venv
python3 -m venv truffle-env
# On Linux/macOS:
source truffle-env/bin/activate
# On Windows (PowerShell):
truffle-env\Scripts\Activate.ps1
3. The SDK
Ensure you have Python 3.10+ installed and your virtual environment is activated, then install the Truffle SDK:
pip install truffle-sdk