Use different Python version with virtualenv

后端 未结 30 3907
自闭症患者
自闭症患者 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:23

    As already mentioned in multiple answers, using virtualenv is a clean solution. However a small pitfall that everyone should be aware of is that if an alias for python is set in bash_aliases like:

    python=python3.6
    

    this alias will also be used inside the virtual environment. So in this scenario running python -V inside the virtual env will always output 3.6 regardless of what interpreter is used to create the environment:

    virtualenv venv --python=pythonX.X
    

提交回复
热议问题