- Start docker container with desired gcc version
- Add your pynev directory as a volume inside the container
- only use the same path as your user if you know what you are doing
Command:
docker run --rm -it -v /home/vbox/.pyenv/:/home/user/.pyenv gcc:13 bash
- add same user as yours
- change to it
useradd -ms /bin/bash vbox
su vbox
cd /home/user
CONFIGURE_OPTS="--with-lto --enable-optimizations --with-computed-gotos --enable-ipv6 --with-system-ffi" CFLAGS="-march=znver3 -mtune=znver3 -fno-semantic-interposition" .pyenv/bin/pyenv install -k -v 3.11.3
cd /home/vbox
cp -r .pyenv/versions/3.11.3/ /home/user/.pyenv/versions/3.11.3/
.pyenv/versions/3.11.3/bin/python -VV
Output:
Python 3.11.3 (main, Aug 20 2023, 09:49:00) [GCC 13.2.0]