On 09/10/2018 09:10 AM, Alex Kleider wrote: > In another currently active thread Mats Wichmann recommends using: > python -m pip install ... > vs > pip install ... > > The question is how to install a specific version of python itself. > > I'm running Ubuntu 16.04 and have the following notes to myself as to > how to install version 3.6 which was the one I wanted at the time: > > sudo add-apt-repository ppa:jonathonf/python-3.6 > sudo apt-get update > sudo apt-get install python3.6 > pip install --user virtualenvwrapper > echo "source virtualenvwrapper.sh" >> ~/.bashrc > source ~/.bashrc > mkvirtualenv --python=python3.6 p36 > > Should I modify these notes? > What should I do if/when I'm looking to use the next version (3.7 and > beyond?) > Will things be completely different if/when I finally decide to move up > to Ubuntu 18.04? > > Thanks, > Alex >
I have done it this way, assuming I don't want to replace the system Python. This is a completely optional framework, but I've found it useful. One time only: $ git clone https://github.com/pyenv/pyenv.git ~/.pyenv # set up environment variables for use by pyenv, # as noted in pyenv readme: $ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile $ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile Any time I want to install a Python version: $ pyenv rehash $ pyenv install 3.7.0 Inside a project that wants to use 3.7.0: $ pyenv local 3.7.0 To see what is available to install: $ pyenv install list To simplify creating virtualenvs, there is a pyenv-virtualenv plugin described here: https://github.com/pyenv/pyenv-virtualenv _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor