Home > Net >  Is there a way to change which pip to use at this project?
Is there a way to change which pip to use at this project?

Time:11-19

I'm trying to make a pip install of the fastf1 library. I noticed that I was using py 3.7 and that lib requires 3.8 or superior. I updated my interpreter (to python 3.10) but, the pip install keeps returning "ERROR: Could not find a version that satisfies the requirement fastf1". My python --version returns 3.10, but my pip version, although updated, still calling the anaconda's pip

How do I change the main pip to be used in this project?

Terminal result:

PS C:\Users...\Github\speedmetrica\DataAnalysis> python --version Python 3.10.0 PS C:\Users...\Github\speedmetrica\DataAnalysis> pip --version pip 21.3.1 from c:\users\jgbal\anaconda3\lib\site-packages\pip (python 3.7)

CodePudding user response:

If python --version is running the desired version of Python, instead of running:

pip install packagename

run:

python -mpip install packagename

That runs the pip module installed for that version of Python as the entry point using the same Python executable you've been running, so it will install for that version of Python as well.

If you're on Windows, and installed as admin to install the Python launcher for Windows, you can be avoid relying on the PATH having a specific version appear first by running:

py -3 -mpip install packagename

which will run the latest installed version of Python 3. Changing to:

py -3.10 -mpip install packagename

will force it to run the latest installed copy of Python 3.10 specifically.

  • Related