Reputation: 487
I'm using python 3.8 but pytest keeps getting imported from 2.7 These are my commands:
python3.8 -m venv venv
. ./venv/bin/activate
pip3.8 install --upgrade pip
pip3.8 install -U pytest
pip3.8 install -r requirements.txt
Then I check:
(venv) xxx@xxx:~/Documents/my-dashboard$ pytest --version
This is pytest version 3.3.2, imported from /usr/lib/python2.7/dist-packages/pytest.pyc
Why is pytest imported from 2.7 version if my environment is using 3.8? How do I import pytest from 3.8?
Upvotes: 0
Views: 509
Reputation: 15442
If you’re installing with python3.8 and pip3.8 you should run with:
python3.8 -m pytest
Your default python on your path seems to be 2.7, so you need to change your PATH or be explicit about which python you want to run.
Upvotes: 2