Using different versions of python with virtualenvwrapper

后端 未结 5 1948
天涯浪人
天涯浪人 2021-01-30 16:49

I\'ve got various versions of python installed on my Mac using Macports. When I\'ve selected python 2.7 via $ port select python python27, virtualenvwrapper works p

5条回答
  •  青春惊慌失措
    2021-01-30 17:30

    Confirmed the use of two similarly-named environment variables:

    VIRTUALENVWRAPPER_PYTHON -- which Python version is used by the virtualenvwrapper utility itself. In other words, which version of Python executes virtualenvwrapper, as if that Python version had been explicitly named in the #! line of the virtualenvwrapper script file.

    VIRTUALENV_PYTHON -- which Python version will be installed by virtualenv when you create a new virtual environment. Equivalent to -p / --python option on the virtualenv command line.

    And perhaps obviously :) the version of Python run in a virtual environment is the version you install for that environment -- has no relation to the above environment variables after the env is created.

    See https://stackoverflow.com/a/24724360/763269 for how to upgrade Python within a virtualenv.

提交回复
热议问题