Home > Software design >  install pip on python 3.7 ubuntu
install pip on python 3.7 ubuntu

Time:11-16

I am working on ubuntu, I have python 3.8 as standard installation. However as my project have dependency on python 3.7 I have installed 3.7 and removed 3.8 now when I am trying to install pip it is installing python3.8 again and getting installed with 3.8. I am using apt-get -y install pip to install pip.

I want to install pip on top of my python3.7 installation so that pip uses python3.7

Thanks, Yatrik

CodePudding user response:

my project have dependency on python 3.7

This is where virtual environments really useful. The idea is that you create an environment in which the required version of python and packages can live without altering the installation of python you might want to keep installed for other projects.

There are a few options, but Anaconda / miniconda are a popular way of using virtual environments and fairly easy to use. First you'll need to install miniconda:

https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html

After that from a terminal you need to create your new environment

conda create -n "py3p7" python=3.7

Then activate it:

conda activate py3p7

Then check that you've got pip installed and it's installed under the right python version:

pip --version

Which for me returns:

pip 22.2.2 from /home/MY_NAME/miniconda3/envs/py3p7/lib/python3.7/site-packages/pip (python 3.7)

CodePudding user response:

Install it with: python3.7 -m pip install pip

  • Related