Switching python2 and Python3 environments on MAC OS

Source: Internet
Author: User
Tags virtual environment virtualenv

Issue background

Python programming on Mac Book Pro requires a different Python environment to be used in different projects due to the installation of Python2 and PYTHON3 environments, which requires switching between the two environments.

System Configuration
    • Mac OS Yosemite 10.10.3 (14d136)
    • python2.7.9 python3.4.3
Solution Solutions
    • Installing homebrew
    • Installing Python2 and Python3 using homebrew
    • Installing Virtualenv
    • Create a virtual environment using VIRTUALENV
    • Activating a virtual environment
Installing homebrew

Https://github.com/Homebrew/homebrew

Installing Python2 and Python3 using homebrew

$brew Install Python

$brew Install Python3

Installing Virtualenv

The corresponding version of VIRTUALENV will be installed automatically during the brew installation Python version two

Create a virtual environment using VIRTUALENV

http://simononsoftware.com/virtualenv-tutorial/

    • Create a working directory

      mkdir virt_env

    • Create a virtual environment on the working directory

      Virtualenv virt_env/virt1–python=python3.4.3
      Or
      Virtualenv virt_env/virt1–python=python2.7.9

    • Activating a virtual environment

      SOURCE Virt_env/virt1/bin/activate

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Switching python2 and Python3 environments on MAC OS

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.