本文介绍了在Visual Studio Code中从正确的anaconda环境启动PyLint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让PyLint在vscode内部自动使用正确的conda环境,但仍然出现导入错误:[pylint] E0401:Unable to import 'django',尽管:

I'm trying to make PyLint automagically use correct conda environment inside vscode but still getting import errors: [pylint] E0401:Unable to import 'django', although:

  • 我正在从正确的环境开始vscode. [1]
  • 我已经安装了 Python 扩展程序. [2]
  • 我设置了正确的python.path. [3]
  • I'm starting vscode from correct environment. [1]
  • I have installed Python extension. [2]
  • I have set correct python.path. [3]

推荐答案

您必须在此conda环境中安装了pylint.

You have to have installed pylint in this conda environment.

  1. 使用activate env_name(Windows)或source activate env_name激活给定的环境.

  1. Activate given environment with activate env_name (Windows) or source activate env_name.

在以下环境中安装pylint:

Install pylint in this environment:

conda install pylint # or 'pip install pylint'

  • 最后重新启动vscode.

  • Finally restart vscode.

    来源: https://github.com/DonJayamanne/pythonVSCode/wiki/Troubleshooting-棉绒

    这篇关于在Visual Studio Code中从正确的anaconda环境启动PyLint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 06-12 01:09