Change Virtual Environment Python Version

  1. Remove existing virtual environment Python files

      rm .Python
      rm bin/pip{,2,2.7}
      rm bin/python{,2,2.7}
      rm -r include/python2.7
      rm lib/python2.7/*
      rm -r lib/python2.7/distutils
      rm lib/python2.7/site-packages/easy_install.*
      rm -r lib/python2.7/site-packages/pip
      rm -r lib/python2.7/site-packages/pip-*.dist-info
      rm -r lib/python2.7/site-packages/setuptools
      rm -r lib/python2.7/site-packages/setuptools-*.dist-info

      Run the commands above to delete all python files (assuming that the old python version is python 2).

  2. Initialise Virtual Environment with new Python version

    • virtualenv -p `which python3` .

      Run the command above inside the existing environment path.

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.