Mac终端flake8-版本pip3下载后找不到flake8

时间:2019-03-23 20:12:23

标签: python-3.x sublimetext3 flake8

首先,感谢您这么活跃的社区。有帮助!我在OSX 10.13上。我在Mac上安装了Python 3和2,并使用命令(python3 -m pip install flake8)下载flake8。一切似乎都很顺利,但是当我输入时:

$ flake8 --version

显示“找不到命令”。我想在sublime文字3中使用flake8,但是现在,它似乎没有指向正确的位置。如果我输入:

$ pip3 show -f flake8

它找到位置(下面的代码)。任何帮助将不胜感激。


Name: flake8
Version: 3.7.7
Summary: the modular source code checker: pep8, pyflakes and co
Home-page: https://gitlab.com/pycqa/flake8
Author: Tarek Ziade
Author-email: tarek@ziade.org
License: MIT
Location: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
Requires: entrypoints, pycodestyle, pyflakes, mccabe
Required-by: 
Files:
  ../../../bin/flake8
  flake8-3.7.7.dist-info/INSTALLER
  flake8-3.7.7.dist-info/LICENSE
  flake8-3.7.7.dist-info/METADATA
  flake8-3.7.7.dist-info/RECORD
  flake8-3.7.7.dist-info/WHEEL
  flake8-3.7.7.dist-info/entry_points.txt
  flake8-3.7.7.dist-info/top_level.txt
  flake8/__init__.py
  flake8/__main__.py
  flake8/__pycache__/__init__.cpython-37.pyc
  flake8/__pycache__/__main__.cpython-37.pyc
  flake8/__pycache__/checker.cpython-37.pyc
  flake8/__pycache__/defaults.cpython-37.pyc
  flake8/__pycache__/exceptions.cpython-37.pyc
  flake8/__pycache__/processor.cpython-37.pyc
  flake8/__pycache__/statistics.cpython-37.pyc
  flake8/__pycache__/style_guide.cpython-37.pyc
  flake8/__pycache__/utils.cpython-37.pyc
  flake8/api/__init__.py
  flake8/api/__pycache__/__init__.cpython-37.pyc
  flake8/api/__pycache__/legacy.cpython-37.pyc
  flake8/api/legacy.py
  flake8/checker.py
  flake8/defaults.py
  flake8/exceptions.py
  flake8/formatting/__init__.py
  flake8/formatting/__pycache__/__init__.cpython-37.pyc
  flake8/formatting/__pycache__/base.cpython-37.pyc
  flake8/formatting/__pycache__/default.cpython-37.pyc
  flake8/formatting/base.py
  flake8/formatting/default.py
  flake8/main/__init__.py
  flake8/main/__pycache__/__init__.cpython-37.pyc
  flake8/main/__pycache__/application.cpython-37.pyc
  flake8/main/__pycache__/cli.cpython-37.pyc
  flake8/main/__pycache__/debug.cpython-37.pyc
  flake8/main/__pycache__/git.cpython-37.pyc
  flake8/main/__pycache__/mercurial.cpython-37.pyc
  flake8/main/__pycache__/options.cpython-37.pyc
  flake8/main/__pycache__/setuptools_command.cpython-37.pyc
  flake8/main/__pycache__/vcs.cpython-37.pyc
  flake8/main/application.py
  flake8/main/cli.py
  flake8/main/debug.py
  flake8/main/git.py
  flake8/main/mercurial.py
  flake8/main/options.py
  flake8/main/setuptools_command.py
  flake8/main/vcs.py
  flake8/options/__init__.py
  flake8/options/__pycache__/__init__.cpython-37.pyc
  flake8/options/__pycache__/aggregator.cpython-37.pyc
  flake8/options/__pycache__/config.cpython-37.pyc
  flake8/options/__pycache__/manager.cpython-37.pyc
  flake8/options/aggregator.py
  flake8/options/config.py
  flake8/options/manager.py
  flake8/plugins/__init__.py
  flake8/plugins/__pycache__/__init__.cpython-37.pyc
  flake8/plugins/__pycache__/manager.cpython-37.pyc
  flake8/plugins/__pycache__/pyflakes.cpython-37.pyc
  flake8/plugins/manager.py
  flake8/plugins/pyflakes.py
  flake8/processor.py
  flake8/statistics.py
  flake8/style_guide.py
  flake8/utils.py

我相信代码的输出要求我提供更多的依赖关系,但不确定是什么。谢谢。

1 个答案:

答案 0 :(得分:0)

这意味着flake8可能不在$ PATH环境变量中。请尝试which flake8确定。如果不存在,请确保添加它。

例如在我的工作环境中

$ which flake8
/Library/Frameworks/Python.framework/Versions/3.6/bin/flake8

以及我用来声明PATH环境变量的.bash_profile中

PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:...."
export $PATH