简体   繁体   中英

Flake8 uses system python instead of virtualenv

My flake8 is giving different outputs to a colleague's, and the difference seems to be in the python version:

(hydro2) andrew@xxx $ flake8 --version
3.5.0 (mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 2.7.12 on Linux

Whereas on his machine it says CPython 3.5.0 or so.

I'm running the flake8 installed inside a python 3.5 virtualenv, and everything seems to point to the right place:

(hydro2) andrew@xxx $ which python
/home/andrew/virtualenvs/hydro2/bin/python
(hydro2) andrew@xxx $ python --version
Python 3.5.2
(hydro2) andrew@xxx $ which flake8
/home/andrew/virtualenvs/hydro2/bin/flake8

So I'm just confused as to why it's using CPython 2.7.12 (which is my OS's default) instead of the virtualenv's version?

I have tried uninstalling and reinstalling flake8 in the virtualenv.

To run a command line tool from a virtual environment you use python -m

Therefore, to run flake8 from your virtual environment:

python -m flake8

This assumes that you activated your virtual environment.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM