expyriment is a great Python library to program psychology experiments.
However pip install expyriment
fails with many versions of Python because it tries to recompile pygame
Here we show how to use pyenv to create an environement with Python 3.7.6 in which "pip install expyriment" should work.
sudo apt install -y python3-pip python-is-python3 python3.10-venv
sudo apt install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl
curl https://pyenv.run | bash
cat >> .bashrc <<'EOF'
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
EOF
source .bashrc
pyenv install 3.7.6
pyenv virtualenv 3.7.6 expyriment
pyenv activate expyriment
pip install expyriment
pyenv activate expyriment