how to build a different version python virtual environment in mac os x

How to build a different version python virtual env.

  • install python from official website
  • check the python execute path
    1
    echo $PATH

Python execute path

  • Go to Python folder

    1
    cd my_project_folder
  • Create Python Virtual Environment

    1
    virtualenv -p /Library/Frameworks/Python.framework/Versions/<VersionNumer>/bin/python<VersionNumer> venv
  • Acsource Python Virtual Environment

    1
    source venv/bin/activate
  • Deactivate Python Virtual Environment
    1
    deactivate