-1

I want to use the Google Sheets API. For this i need to install a package: pip install gspread oauth2client

If I try this package to install I get this error: rsa requires Python '>=3.5, <4' but the running Python is 2.7.16

Python 2.7.16
Python 3.9.4

Btw: pip install "gspread" "oauth2client" didnt help

Want can I do to change the running Python to Python 3 ? Thanks

ben.reisinger
  • 23
  • 2
  • 8
  • In most cases `pip3` or `python3 -m pip` will do the trick. You will also have to run your code with `python3` then. – Klaus D. Apr 11 '21 at 19:37
  • If the command `pip3` exists, use that instead of pip. Otherwise use `which -a pip` to see where pip is, and enter the full path for the python3 version. – alexis Apr 11 '21 at 19:37
  • Thanks, I needed to update pip first, then it did work. – ben.reisinger Apr 11 '21 at 19:40

2 Answers2

1

Try using pip3 install gspread instead of only pip.

pip3 refers to your Python3 version installed, pip2 to the Python2 version, while pip chooses the best one based on the environment in which you're running the command.

BufuWinner
  • 11
  • 2
0

I had a strange issue where python3 -m pip install vosk wasn't working and gave the error (requires-python:>=3) even though I definitely have python 3 installed as /usr/bin/python3.

I "fixed" it with venv:

python3 -m venv /my/dir
. /my/dir/bin/activate
pip install --upgrade pip
pip install vosk
# and it worked!

If course I would have liked to do this without venv, but sigh.

(Now that i think of it i wonder if simply upgrading pip was enough to solve the issue.)

Hope this helps someone else!

KJ7LNW
  • 1,437
  • 5
  • 11