Use different Python version with virtualenv

后端 未结 30 3333
自闭症患者
自闭症患者 2020-11-21 05:03

I have a Debian system currently running with python 2.5.4. I got virtualenv properly installed, everything is working fine. Is there a possibility that I can use a virtuale

30条回答
  •  灰色年华
    2020-11-21 05:25

    The -p approach works well, but you do have to remember to use it every time. If your goal is to switch to a newer version of Python generally, that's a pain and can also lead to mistakes.

    Your other option is to set an environment variable that does the same thing as -p. Set this via your ~/.bashrc file or wherever you manage environment variables for your login sessions:

    export VIRTUALENV_PYTHON=/path/to/desired/version
    

    Then virtualenv will use that any time you don't specify -p on the command line.

提交回复
热议问题