Use different Python version with virtualenv

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

    On the mac I use pyenv and virtualenvwrapper. I had to create a new virtualenv. You need homebrew which I'll assume you've installed if you're on a mac, but just for fun:

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
    
    brew install pyenv
    pyenv install 2.7.10
    pyenv global 2.7.10
    export PATH=/Users/{USERNAME}/.pyenv/versions/2.7.10/bin:$PATH
    mkvirtualenv -p ~/.pyenv/versions/2.7.10/bin/python  {virtual_env_name}
    

    I also froze my requirements first so i could simply reinstall in the new virtualenv with:

    pip install -r requirements.txt
    

提交回复
热议问题