Sometimes multiple python versions still hope to be isolated by pyenv to avoid interference between different versions of libraries. Sometimes in order to avoid the influence of inherent bugs, I hope to install a pure environment from scratch, and pyenv can work.
sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
mkdir ~/.pyenv
git clone git://github.com/yyuu/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"'>>~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"'>>~/.bashrc
echo 'eval "$(pyenv init -)"'>>~/.bashrc
exec $SHELL -l
pyenv install --list
An error may be reported, install the corresponding library files in advance and then install the environment
pip error while installing Python: “Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS”
The following library files need to be installed under ubuntu
apt-get install make build-essential libssl-dev zlib1g-dev libbz2-dev libsqlite3-dev
If it is Centos, install the following library files
yum install zlib-devel bzip2-devel sqlite sqlite-devel openssl-devel
Install python3.5.2 environment
pyenv install 3.5.2
pyenv install 3.4.5 //The package that comes with the installation is pip and setuptools
Switch the system default Python version:
& pyenv global 3.4.5
Install the packages you need:
$ sudo ~/.pyenv/version/3.4.1/pip3 install requests
or it could be
$ pip install xxx //xxx is the package name
pip install requests
sudo ~/.pyenv/version/3.4.1/pip3 install requests
( adsbygoogle = window.adsbygoogle || []).push({});
Recommended Posts