Adam Barnes Adam Barnes - 10 months ago 84
Python Question

pip installing flake8 in a Python3 virtualenv installs flake8 for python 2.7 on OSX

I'm trying to set atom up correctly, and the

package is annoying me by pointing out syntax errors which aren't there, because it's using a python 2 flake8.

Doubly annoying is that when such an error is pointed out in a file, the rest of the file isn't linted, making finding unused imports that much harder.

I set the executable path in the settings to point to the right binary after pip installing it, but the same errors occur.

$ which python
$ which pip
$ pip install flake8
$ which flake8
$ python -V
Python 3.5.1
$ pip -V
pip 8.1.2 from /Users/asday/.virtualenvs/_/lib/python3.5/site-packages (python 3.5)
$ flake8 --version
2.5.4 (pep8: 1.7.0, pyflakes: 1.0.0, mccabe: 0.4.0) CPython 2.7.11 on Darwin
$ flake8 .
./ E901 SyntaxError: invalid syntax

Where is simply:

def f(*args, **kwargs):

kwargs = {}


How do I get flake8 to install with the right version of python on OSX?

Answer Source

You could download the flake 8 project from then use

pip install file.whl
This way you can just install it from your local python and it should install as python 3.