Here are some keynotes from python version management system - pyenv
installation
1 | $ curl https://pyenv.run | bash |
install necessary packages based on your linux distribution,
refer https://github.com/pyenv/pyenv/wiki#suggested-build-environment
mirror the download site
follow pyenv mirror guide to build the site, remember the filename of the archieves must be the md5sum of its contents.
Which means most of the public mirror sites does not work in pyenv need.
a solution for this case: download the archieves from the public mirror sites and place them under $(pyenv root)/cache,
customize the build
1 | $ env PYTHON_CONFIGURE_OPTS="--enable-shared --enable-unicode=ucs4 --enable-optimizations" pyenv install 2.7.18 |
- –enable-optimizations: expensive optimizations that slow down the build process but yield a significant speed boost
- –enable-shared: some extension required python shared library. rpath will be set in this case.
- –enable-unicode: python version 2.2 through 3.2 depends on this to representation of unicode strings. utf-16 UCS2/utf-32 UCS4
python -c “import sys; print(sys.maxunicode)” UCS4: 1114111/UCS2: 65535
python 3.7.9 will always returns 1114111 - LDFLAGS=-s: strip all symbols
install specific version for docker image
use python-build plugin
windows version
clone pyenv-win and make symbol link C:\python using
mklink /D
need script to generate regedit entry