在VS Code上的conda-venv中安装pip3和flake8



目标:让flake8 linting工作

我设置了一个新的conda venv。我尝试在命令调色板中选择Flake8作为我的短绒。

更新:我已经安装了pipflake8。但是,VS代码提示:

  • Linter flake8 is not installed
  • There is no pip installer in the selected environment

Ubuntu Bash终端:

(sdg) me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/foo/bar$ sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pip is already the newest version (20.0.2-5ubuntu1.6).
0 upgraded, 0 newly installed, 0 to remove and 124 not upgraded.
(sdg) me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/foo/bar$ pip install flake8
Requirement already satisfied: flake8 in /home/me/.local/lib/python3.8/site-packages (4.0.1)
Requirement already satisfied: pyflakes<2.5.0,>=2.4.0 in /home/me/.local/lib/python3.8/site-packages (from flake8) (2.4.0)
Requirement already satisfied: pycodestyle<2.9.0,>=2.8.0 in /home/me/.local/lib/python3.8/site-packages (from flake8) (2.8.0)
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in /home/me/.local/lib/python3.8/site-packages (from flake8) (0.6.1)
WARNING: You are using pip version 21.3.1; however, version 22.0.3 is available.
You should consider upgrading via the '/home/me/miniconda3/envs/sdg/bin/python -m pip install --upgrade pip' command.

.vscode/settings.json:

{
"python.linting.flake8Enabled": true,
"python.linting.enabled": true
}

我一直在遵循这些解决方案,但运气不佳

安装Pip

使用Flake8

我建议您正确创建一个conda环境:

conda create -n "myenv" python

然后,激活环境:

conda activate myenv

最后,安装flake:

pip install flake8

最新更新