Home > python > pythonz: install any Python version in your HOME folder

pythonz: install any Python version in your HOME folder

You want to install an older / newer version of Python. You don’t want to install it systemwide since you don’t want to mess up your system. How to install it in your HOME folder?

pythonz was made to address this problem. Install it and add an extra line to your .bashrc (see the docs). Some useful commands:

$ pythonz update           # self-update
$ pythonz list             # list of installed Python versions
$ pythonz list -a          # list of available (installable) Python versions
$ pythonz install 3.5.3    # install CPython 3.5.3
$ pythonz locate 3.5.3     # Where is it installed?

Here is how to create a virtualenv using a specific Python version that was installed with pythonz:

$ virtualenv -p $(pythonz locate 3.5.3) ~/.virtualenvs/project_name

I have a project in a virtual environment that works well with Python 3.5 (Ubuntu). Howeverm, under Manjaro the default Python is 3.6 and the project doesn’t work with it, it stops with some error. I didn’t want to dig in, so I installed CPython 3.5.3 with pythonz and used that version in the virtual environment. It works again :)

Categories: python Tags:
  1. May 23, 2017 at 01:05

    Hi! Good post. What are the advantages of having multiple Python installs on a single machine? I’m curious! Thanks!

    • May 23, 2017 at 06:03

      I give an example in the last paragraph. I had Python 3.6 on my system, but I needed Python 3.5 in a specific project. With pythonz I could do it easily. As Python 3.5 was installed in my HOME folder, I didn’t mess up my whole operating system. It’s also useful if you want to try something in a specific version of Python. If you have an Ubuntu LTS, it’s likely you still have Python 3.4 or 3.5. Do you want to try Python 3.6? With pythonz you can.

  2. July 20, 2017 at 21:08

    Any advantage over pyenv (https://github.com/pyenv/pyenv). I’ve only used pyenv with Python (as opposed to stackless, Cython, etc.) and I see that pythonz explicitly advertises that on their GH repo, so perhaps there’s the argument for preferring one over the other.

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: