This blog post is just a brief description of how to install a conceptual question.
Environment: 10.13.1+shell
1. Install Brew
Website address: https://brew.sh/
/usr/bin/ruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. Use Brew to install pyenv
Method 1
$ Brew Update
$ Brew Install pyenv
Method 2
Install via GitHub
I use method one to install
After installation, put F which pyenv >/dev/null; Then eval "$ (pyenv init-)"; Fi Append to ~/.bash_profile
Install the required version:
Pyenv Install 3.6.3
Error during issue:
error:the Python SSL extension was not compiled. Missing The OpenSSL lib?
WORKAROUND: Append export path= "/usr/local/opt/openssl/bin: $PATH" to ~/.bash_profile
Perform
SOURCE ~/.bash_profile
Ldflags= "-l$ (Brew--prefix OpenSSL)/lib" cppflags= "-i$ (Brew--prefix OpenSSL)/include" Pyenv Install 3.6.3
After that, the installation will be successful.
Pyenv install 3.6.3 version of Python
Installing virtualenv
Brew Install Pyenv-virtualenv
Create an environment using the PYENV virtualenv version number Environment name command
Error message:
Failed to activate Virtualenv.
Perhaps Pyenv-virtualenv has no been loaded into your shell properly.
Please restart the current shell and try again.
Append environment variables
If which pyenv-virtualenv-init >/dev/null; Then eval "$ (pyenv virtualenv-init-)"; Fi
SOURCE ~/.bash_profile
Pyenv Local 3.6.3 env3.6.3
Since this basic feature has been installed complete
This article is from the "Fight Together" blog, please make sure to keep this source http://zwltc.blog.51cto.com/6019176/1983931
Mac OSX Python Multi-version management tool: Pyenv and virtualenv Build