Since virtualenv can not only isolate the Python version, it can also isolate different versions of the plug-in module and choose the Virtualenv+virtualenvwrapp combination based on the development scenario. First, install VIRTUALENV1, Mac Pro system comes with Python 2.7.102, manually install Python 3.5.43, install pip sudo easy_install pip4, install virtual environment virtualenv sudo pip Install VIRTUALENV5, create environment 1) Create Virtual Environment Storage directory: mkdir ~/py_envs
2) Create a virtual environment CD ~/py_envs virtualenv-p/usr/local/bin/python3 py3env # Create a virtual environment, test the effect 6, activate the environment (switch to the new environment directory) CD PY3ENV # Enter virtual environment Source Bin/activate # Activate virtual environment Python--version #看下版本号是否为python3 7, install dependent package pip install flask pip Install Django Pip install Scipy Note! Do not add sudo, otherwise it will be installed into the system environment, not installed in the virtual Environment 8, exit the environment deactivate two, install the Virtual Environment Management Pack Virtualenvwrapper This thing is the extension of virtualenv, more convenient to add, copy, delete, Switch virtual Environment 1, execute virtualenvwrapper Install command sudo pip install virtualenvwrapper Note: Mac Pro tips Six version conflicts when executed: sudo pip install VIRTUALENVWR Apper-v--ignore-install six2, configuring the environment required before the virtualenvwrapper.sh operation vim ~/.bash_profile export Workon_home=~/py_envssource/ Usr/local/bin/virtualenvwrapper.shexport Virtualenvwrapper_python=/usr/bin/python3, List all current Python virtual environments lsvirtualenv-b4, create virtual Environments mkvirtualenv-p/usr/local/bin/python py2env 5, start or switch virtual environments Workon py2env 6, Exit the virtual environment Deactivate7, delete the virtual environment rmvirtualenv py3env
Mac Pro installs Python multi-version