skip to Main Content

I’ve recently had to debug a cython library for a specific version of python on ubuntu and I needed python, venv, distutils, cython, pip, a compiler, and a text editor. I had to go fishing around the web for instructions on how to do this, so I’m asking this question to answer with what I did.

I googled it and found instructions in one place for pip, another place for venv, another place for compilers.

2

Answers


  1. Chosen as BEST ANSWER

    I figured this out on ubuntu 20 in docker (I was running as root). If you are not running as root - this answer won't help you.

    # update the package manager
    apt-get update
    
    # install git, C/C++ compiler and a text editor (I prefer vim)
    apt install -y git software-properties-common curl build-essential vim
    
    # add package source for python distributions
    add-apt-repository ppa:deadsnakes/ppa
    
    # install specific version of python with venv and distutils
    apt install -y python3.9 python3.9-distutils python3.9-venv
    
    # get pip
    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    python3.9 get-pip.py
    

  2. You have to install the version of python that you want, i recommend use dead-sneak, https://www.codegrepper.com/code-examples/whatever/install+python+3.7+from+source+in+ubuntu+linux.

    Later set your python version in the venv, something like "virtualenv venv –python=python{python version}" or "python{python version} -m venv venv"

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search