I have an issue, when using Visual Studio Code, and when I'm choosing the interpreter of Python to use within a code, I realize there are two different installations or Python 3, besides the two Python2 installations.
The problem comes when I'm trying to use the 'Extract Method' on the 3.8.2 and it tells me to update pip. How do I choose the installation to update pip?
When I run "sudo pip install --upgrade pip" it only goes to the python 2 apple version. But I can't update the pip on the other installations.
Thanks in advance.
You can run python -m pip
to run pip
with a particular Python version. So
sudo /usr/[local/]bin/python[3] -m pip install --upgrade pip
Square brackets []
mean optional parts.
First new version of MacOs are built in python2 and python3 in usr/bin
just leave them and install newest python
then edit path which in /etc/paths put 'usr/local/bin' on the first line
enjoy. now all your python3 is run in usr/local/bin which is newest and installed by yourself. Also pip is work too. if you wanna upgrade your python just run brew upgrade. It's best way to use python on mac and DONT DELETE default python2 and 3 just leave them
As said in Upgrading pip for different versions of python , you can:
Use the python 3.8 interpreter to run the command:
python3.8 -m pip install --upgrade pip
Or use the pip3.8 binary directly:
pip3.8 install --upgrade pip
Note that if the Python command is not in your PATH, you must provide the full path when running the upgrade:
/usr/local/bin/python3 install --upgrade pip
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.