Issue
I'm running CentOS 8 that came with native Python 3.6.8. I needed Python 3.7 so I installed Python 3.7.0 from sources. Now, python
command is unknown to the system, while commands python3
and python3.7
both use Python 3.7.
All good until now, but I can't seem to get pip working.
Command pip
returns command not found, while python3 -m pip
, python3.7 -m pip
, python3 -m pip3
, and python3.7 -m pip3
return No module named pip
. Only pip command that works is pip3
.
Now whatever package I install via pip3
does not seem to install properly. Example given, pip3 install tornado
returns Requirement already satisfied
, but when I try to import tornado in Python 3.7 I get ModuleNotFoundError: No module named 'tornado'
. Not the same thing can be said when I try to import it in Python 3.6, which works flawlessly. From this, I understand that my pip only works with Python 3.6, and not with 3.7.
Please tell me how can I use pip with Python 3.7, thank you.
Solution
It looks like your python3.7
does not have pip.
Install pip for your specific python by running python3.7 -m easy_install pip
.
Then, install packages by python3.7 -m pip install <package_name>
Another option is to create a virtual environment from your python3.7. The venv brings pip into it by default.
You create venv by python3.7 -m venv <venv_name>
Answered By - Lior Cohen Answer Checked By - David Marino (WPSolving Volunteer)