pyenv是用来安装多个版本的python
官方提供了安装脚本
curl https://cdn.jsdelivr.net/gh/pyenv/pyenv-installer/bin/pyenv-installer | bash |
(用jsdeliver是因为raw.githubusercontent.com现在访问不通了)
启用cache:
mkdir -p .pyenv/cache |
使用ccache, 可以缓存构件中的对象
git clone https://github.com/yyuu/pyenv-ccache.git $(pyenv root)/plugins/pyenv-ccache |
安装过程中会出现的错误
zipimport.ZipImportError: can’t decompress data; zlib not available
sudo apt install zlib1g-dev |
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
sudo apt insatll libbz2-dev |
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
sudo apt-get install libreadline-dev |
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
sudo apt install libssl-dev |
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?
sudo apt install libsqlite3-dev |
实际使用的时候可能会报错
ModuleNotFoundError: No module named ‘_ctypes’
sudo apt install libffi-dev |
跟pyinstaller
一起使用,需要添加一个编译选项:
export PYTHON_CONFIGURE_OPTS="--enable-shared" |