Mac Pro installs Python multi-version

Source: Internet
Author: User
Tags install django pip install django virtual environment virtualenv

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.