Reputation: 121
Today I faced a problem regarding pip3 in Ubuntu. Ubuntu comes with python 3.8 but I wanted to use latest versions of python, like 3.9 or maybe 3.10. So I installed it using 'ppa:deadsnakes' repository and also installed pip. But the problem is I want to use pip in python 3.9 instead of version 3.8. So I changed the default python version to 3.9 and everything crashed. So reverted to python 3.8. Whenever I install some package it gets installed using python 3.8. Help me, how can I use python 3.9 pip and install packages in python 3.9 without changing the default version. Any help is appreciated.
--> Thing I want is that when I want to install python package using
pip3 install <package_name>
it must install in python3.9 and not in python3.8
Upvotes: 6
Views: 22223
Reputation: 121
Hello everyone I fixed my issue.
The problem is we cannot override default python version in Ubuntu as so many things depend on it.
So I just made an alias as : alias pip3='python3.9 -m pip'
and alias for python : alias python3='/usr/bin/python3.9'
If anyone face this issue please do what I specify and you will be good to go. Now all my packages are being installed in python3.9.
Upvotes: 4
Reputation: 217
Currently all python3 versions are using the same pip version which can be installed by:
sudo apt-get install python3-pip
The easiest way to work with a specific python version is creating a virtualenv and working under it. When working with a virtualenv you can use pip freely without worrying about which python version it belongs.
Upvotes: 2
Reputation: 304
you can use pip for python3.9 by pip3.9 install <package-name>
Upvotes: -1
Reputation: 191728
You don't need to install pip separately
You should be able to refer to it as such
python3.9 -m pip install
Upvotes: 11