• <i id='SquZZ'><tr id='SquZZ'><dt id='SquZZ'><q id='SquZZ'><span id='SquZZ'><b id='SquZZ'><form id='SquZZ'><ins id='SquZZ'></ins><ul id='SquZZ'></ul><sub id='SquZZ'></sub></form><legend id='SquZZ'></legend><bdo id='SquZZ'><pre id='SquZZ'><center id='SquZZ'></center></pre></bdo></b><th id='SquZZ'></th></span></q></dt></tr></i><div id='SquZZ'><tfoot id='SquZZ'></tfoot><dl id='SquZZ'><fieldset id='SquZZ'></fieldset></dl></div>

        <bdo id='SquZZ'></bdo><ul id='SquZZ'></ul>
      1. <tfoot id='SquZZ'></tfoot>

        <small id='SquZZ'></small><noframes id='SquZZ'>

        <legend id='SquZZ'><style id='SquZZ'><dir id='SquZZ'><q id='SquZZ'></q></dir></style></legend>

        Pylint“未解决的导入";Visual Studio 代码中的错误

        Pylint quot;unresolved importquot; error in Visual Studio Code(Pylint“未解决的导入;Visual Studio 代码中的错误)

          <bdo id='oVarl'></bdo><ul id='oVarl'></ul>

                  <tbody id='oVarl'></tbody>
              1. <tfoot id='oVarl'></tfoot>

                  <small id='oVarl'></small><noframes id='oVarl'>

                  <i id='oVarl'><tr id='oVarl'><dt id='oVarl'><q id='oVarl'><span id='oVarl'><b id='oVarl'><form id='oVarl'><ins id='oVarl'></ins><ul id='oVarl'></ul><sub id='oVarl'></sub></form><legend id='oVarl'></legend><bdo id='oVarl'><pre id='oVarl'><center id='oVarl'></center></pre></bdo></b><th id='oVarl'></th></span></q></dt></tr></i><div id='oVarl'><tfoot id='oVarl'></tfoot><dl id='oVarl'><fieldset id='oVarl'></fieldset></dl></div>
                • <legend id='oVarl'><style id='oVarl'><dir id='oVarl'><q id='oVarl'></q></dir></style></legend>
                  本文介绍了Pylint“未解决的导入";Visual Studio 代码中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用以下设置

                  • macOS v10.14 (Mojave)
                  • Python 3.7.1
                  • Visual Studio 代码 1.30
                  • Pylint 2.2.2
                  • Django 2.1.4

                  我想使用 linting 让我在 Visual Studio Code 中的生活更轻松一些.但是,对于每个导入,我都有未解决的导入"状态.即使是默认的 Django 导入(即从 django.db 导入模型).

                  I want to use linting to make my life a bit easier in Visual Studio Code. However, for every import I have states "unresolved import". Even on default Django imports (i.e. from django.db import models).

                  我猜是因为它没有看到虚拟环境 Python 文件.

                  I presume it is because it is not seeing the virtual environment Python files.

                  一切正常,但开始变得烦人.

                  Everything works just fine, but it's starting to get annoying.

                  我选择的解释器都是 Python 的系统版本.它似乎根本看不到我的虚拟环境 Python(它与我的工作区不在同一个目录中,所以这部分是有道理的).

                  The interpreter choices I have are all system versions of Python. It does not seem to see my virtual environment Python at all (it is not in the same directory as my workspace, so that part makes sense).

                  如果我在 settings.json 文件中设置了 python.PythonPath,它只会忽略它并且不会将我的虚拟环境路径作为选项列出.我也尝试在我的全局 Python 设置中设置它,但它也没有显示出来.

                  If I set up the python.PythonPath in the settings.json file, it just ignores it and does not list my virtual environment path as an option. I also tried setting it up in my global Python settings, but it also does not show up.

                  有没有快速解决办法让它工作?

                  Is there a quick fix to get it working?

                  推荐答案

                  在你的 工作区设置,你可以像这样设置你的 Python 路径:

                  In your workspace settings, you can set your Python path like this:

                  {
                      "python.defaultInterpreterPath": "/path/to/your/venv/bin/python",
                  }
                  

                  这篇关于Pylint“未解决的导入";Visual Studio 代码中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Split a Pandas column of lists into multiple columns(将 Pandas 的列表列拆分为多列)
                  How does the @property decorator work in Python?(@property 装饰器在 Python 中是如何工作的?)
                  What is the difference between old style and new style classes in Python?(Python中的旧样式类和新样式类有什么区别?)
                  How to break out of multiple loops?(如何打破多个循环?)
                  How to put the legend out of the plot(如何将传说从情节中剔除)
                  Why is the output of my function printing out quot;Nonequot;?(为什么我的函数输出打印出“无?)
                    <legend id='Wi44Q'><style id='Wi44Q'><dir id='Wi44Q'><q id='Wi44Q'></q></dir></style></legend>

                      <small id='Wi44Q'></small><noframes id='Wi44Q'>

                          <bdo id='Wi44Q'></bdo><ul id='Wi44Q'></ul>

                            <i id='Wi44Q'><tr id='Wi44Q'><dt id='Wi44Q'><q id='Wi44Q'><span id='Wi44Q'><b id='Wi44Q'><form id='Wi44Q'><ins id='Wi44Q'></ins><ul id='Wi44Q'></ul><sub id='Wi44Q'></sub></form><legend id='Wi44Q'></legend><bdo id='Wi44Q'><pre id='Wi44Q'><center id='Wi44Q'></center></pre></bdo></b><th id='Wi44Q'></th></span></q></dt></tr></i><div id='Wi44Q'><tfoot id='Wi44Q'></tfoot><dl id='Wi44Q'><fieldset id='Wi44Q'></fieldset></dl></div>

                              <tbody id='Wi44Q'></tbody>
                          • <tfoot id='Wi44Q'></tfoot>