LoginSignup
4
5

More than 5 years have passed since last update.

flake8を入れるとpyflakesのバージョンが最新じゃなくなるぽい

Last updated at Posted at 2017-09-01

問題

pip install pyflakes
pip install flake8

これで flake8 --version すると

3.4.1 (mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.5.0) CPython 3.6.2 on Darwin

となる。最新のpyflakesは1.6.0

実際、

root@a0241303ada3:/# pip install pyflakes
Collecting pyflakes
  Downloading pyflakes-1.6.0-py2.py3-none-any.whl (227kB)
    100% |████████████████████████████████| 235kB 1.0MB/s
Installing collected packages: pyflakes
Successfully installed pyflakes-1.6.0
root@a0241303ada3:/# pip install flake8
Collecting flake8
  Downloading flake8-3.4.1-py2.py3-none-any.whl (68kB)
    100% |████████████████████████████████| 71kB 1.0MB/s
Collecting mccabe<0.7.0,>=0.6.0 (from flake8)
  Downloading mccabe-0.6.1-py2.py3-none-any.whl
Collecting pyflakes<1.6.0,>=1.5.0 (from flake8)
  Downloading pyflakes-1.5.0-py2.py3-none-any.whl (225kB)
    100% |████████████████████████████████| 225kB 941kB/s
Collecting pycodestyle<2.4.0,>=2.0.0 (from flake8)
  Downloading pycodestyle-2.3.1-py2.py3-none-any.whl (45kB)
    100% |████████████████████████████████| 51kB 3.1MB/s
Installing collected packages: mccabe, pyflakes, pycodestyle, flake8
  Found existing installation: pyflakes 1.6.0
    Uninstalling pyflakes-1.6.0:
      Successfully uninstalled pyflakes-1.6.0
Successfully installed flake8-3.4.1 mccabe-0.6.1 pycodestyle-2.3.1 pyflakes-1.5.0

flake8をインストールするとpyflakes-1.6.0がアンインストールされてしまう。

解決方法

pip install flake8
pip install pyflakes -U

pip install パッケージ -U
または
pip install パッケージ --upgrade
でパッケージをアップデート出来るので、flake8でpyflakesを入れてからupdateする

なんでこれ見つけたか

CIいじってたときにpyflakes-1.6.0で修正されたlintエラーが出ていたからおかしいと思ってた。
ちなみにこれ

from typing import Optional


class A:
    def __init__(self):
        self.v: Optional[int] = None

このとき、pyflakes-1.5.0ではOptional使われてないって怒られる。
pyflakes-1.6.0では修正されている

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5