Skip to content
Advertisement

pytest requires Python ‘>=3.5’ but the running Python is 2.7.10

I’m trying to install pytest using pip but running into this error:

pytest requires Python '>=3.5' but the running Python is 2.7.10

Pretty sure pytest is compatible with python 2. Any reason why I am not able to install it on my machine? As you can see in the error, I am running python 2.7.10 and do not have issue installing other packages.

Advertisement

Answer

Quoting the changelog:

The 4.6.X series will be the last series to support Python 2 and Python 3.4.

Therefore, use

$ pip install "pytest<5"

to install the latest pytest version that supports Python 2.7.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement