Python unresolved reference error

Resolve references PyCharm’s on-the-fly inspection immediately detects unresolved references, and highlights them with the red curvy line. PyCharm suggests quick fixes to deal with the unresolved references in the source code. Apply a quick-fix Place the caret at an unresolved reference, PyCharm shows the red light bulb. Click the bulb, or press Alt+Enter to […]

Содержание

  1. Resolve references
  2. Apply a quick-fix
  3. Resolve references
  4. Apply a quick-fix
  5. Pycharm: ошибка «неразрешенной ссылки» на IDE при открытии рабочего проекта
  6. ОТВЕТЫ
  7. Ответ 1
  8. Ответ 2
  9. Теперь выполните следующие действия
  10. Ответ 3
  11. Ответ 4
  12. Ответ 5
  13. Ответ 6
  14. Ответ 7
  15. Как исправить ошибку: Unresolved attribute reference ‘message_handler’ for class ‘TeleBot’?

Resolve references

PyCharm’s on-the-fly inspection immediately detects unresolved references, and highlights them with the red curvy line. PyCharm suggests quick fixes to deal with the unresolved references in the source code.

Apply a quick-fix

Place the caret at an unresolved reference, PyCharm shows the red light bulb.

Click the bulb, or press Alt+Enter to reveal the list of available quick fixes:

PyCharm suggests a number of solutions. For example, choose one of the following options:

Import this name to add an import statement.

Create parameter to add a parameter with some initial value to the list of function parameters.

Ignore unresolved reference . The fully qualified name of the symbol will be added to the list of ignored references ( File | Settings | Editor | Inspections — Python — Unresolved references ).

Mark all attributes of as ignored . In this case, the list of ignored references ( File | Settings | Editor | Inspections — Python — Unresolved references ) will be modified with the fully qualified name of the type with the wildcard (*) at the end.

Источник

Resolve references

PyCharm’s on-the-fly inspection immediately detects unresolved references, and highlights them with the red curvy line. PyCharm suggests quick fixes to deal with the unresolved references in the source code.

Apply a quick-fix

Place the caret at an unresolved reference, PyCharm shows the red light bulb.

Click the bulb, or press Alt+Enter to reveal the list of available quick fixes:

PyCharm suggests a number of solutions. For example, choose one of the following options:

Import this name to add an import statement.

Create parameter to add a parameter with some initial value to the list of function parameters.

Ignore unresolved reference . The fully qualified name of the symbol will be added to the list of ignored references ( File | Settings | Editor | Inspections — Python — Unresolved references ).

Mark all attributes of as ignored . In this case, the list of ignored references ( File | Settings | Editor | Inspections — Python — Unresolved references ) will be modified with the fully qualified name of the type with the wildcard (*) at the end.

Источник

Pycharm: ошибка «неразрешенной ссылки» на IDE при открытии рабочего проекта

Введение

У меня есть проект Python в репозитории git. Все работает нормально для большинства членов команды, мы можем синхронизировать код и редактировать его без каких-либо проблем с Pycharm на разных платформах (Windows, Linux)

Проблема

На одном из компьютеров мы получаем «Unresolved reference» по всему коду почти для каждого импорта, за исключением встроенных в Python библиотек (т.е. импортирует datetime). На этом компьютере установлена ​​версия Pycharm Mac.

Вопрос

Кто-нибудь знает, как это решить?, так как большая часть импорта не распознается завершением кода и навигацией через goto- > declare и т.д., не работает. Есть ли известная проблема с версией Mac?

ОТВЕТЫ

Ответ 1

Ключ должен указывать исходный каталог в качестве корня источника. Попробуйте следующее:

  • В представлении «Проект» щелкните правой кнопкой мыши исходный каталог Python
  • В меню диалога выберите Отметить каталог как >Корень источника

Теперь папка должна быть синей, а не бежевой, чтобы указать, что это исходная папка Python.

Вы также можете настроить это в настройках PyCharm, выполнив следующее для проекта, который уже находится в PyCharm:

  • На панели инструментов Mac выберите PyCharm >Настройки
  • В открывшемся окне выберите Структура проекта в панели меню слева.
  • Выберите проект в средней панели, если необходимо
  • Щелкните правой кнопкой мыши на источнике Python в правой панели и выберите Источники в диалоговом окне меню

Ответ 2

У меня также была проблема, и мне потребовалось несколько часов, чтобы найти точное решение.

Вам нужно подтвердить следующее.

‘django.contrib.staticfiles’ , добавляется в INSTALLED_APPS в файле settings.py вашего приложения.

Каталог со статическим содержимым (например, изображениями) с именем static находится под корнем приложения.

Теперь выполните следующие действия

PyCharm > Настройки > Настройки проектa > Django

Убедитесь, что ваши Django Project root , settings.py и manage.py script четко определены в диалоговом окне.

Вы хорошо пойдете. Надеюсь это поможет.

Ответ 3

Я сделал все вышеперечисленное из einnocent и myildirim, но все равно должен был сделать следующее:

закрыть pycharm и вручную удалить папку .idea, это удалит все, что pycharm знает о коде.

открыть pycharm, reimport проект

комбинация установки правильного корня источника, перезапуск python с invalide cache и удаление папки .idea/реимпорт проекта pycharm исправили его для меня.

Ответ 4

Я столкнулся с аналогичной проблемой с pyspark (искра 2.1) и luigi.

Сбой попытки:

  • Настройка переменной среды PYTHONPATH
  • Недействительный кеш и перезапуск pycharm
  • Отметьте каталог как Корень источника

Неразрешенная ссылка pyspark может быть исправлена ​​путем добавления каталога искрового питона в Content Root в проекте, но запуск проекта в качестве задачи luigi дал та же ошибка.

Успешные шаги

    Создайте пустой __init__.py файл в проекте

Включите следующие строки кода вверху script

и нерешенной проблемой ссылка ошибка была исправлена ​​как в PyCharm и задачи LuiGi.

Ответ 5

Другой причиной может быть проектный интерпретатор. Например, если вы используете Python3.x, но интерпретатор предназначен для Python2.x. Вы можете проверить здесь:

Файл | Настройки | Проект: ‘projectname’ | Переводчик проекта

Ответ 6

PyCharm — Alt-F (ile); Настройки; Структура проекта; нажмите + добавить корневой контент; укажите свою папку, содержащую пакет, в конфликте:/home/joker/anaconda3/envs/conda_py27/lib/python2.7/site-packages. Я дополнительно отмечен как ресурсы (не уверен, что это обязательно). Нажмите «ОК», и произойдет переиндексация. Эта решила проблему для меня в PyCharm Professional 2016.2.3

Ответ 7

Моя десятка — Если вы работаете с виртуальными средами (у вас есть каталог venv ), убедитесь, что он помечен как исключенный.

  • В представлении «Проект» щелкните правой кнопкой venv каталог venv
  • В диалоговом меню выберите Пометить каталог как >исключенный

Каталог должен стать оранжевым.

Это иногда случается, если вы сделали git clean или по какой-то причине вам пришлось перестраивать вашу среду, а PyCharm не заметил

Источник

Как исправить ошибку: Unresolved attribute reference ‘message_handler’ for class ‘TeleBot’?

Написал код на Python для бота в telegramm.
Написал такой простой код на Python 3.11.0:

Предварительно были установлены следующие пакеты pip:

После запуска кода появляются следующие ошибки:

  1. Unresolved attribute reference ‘message_handler’ for class ‘TeleBot’
  2. Unexpected argument
  3. PEP 8: E302 expected 2 blank lines, found 1
  4. PEP 8: W292 no newline at end of file

В связи с чем могут появляться эти ошибки и как их устранить?

  • Вопрос задан 30 окт. 2022
  • 248 просмотров

Простой 10 комментариев

Привет.
Во-первых, не стоит палить ключ доступа к своему боту в интернете. Зная ключ, любой им сможет воспользоваться. Сменить можно через BotFather
3 и 4 — это просто несоблюдение правил форматирования кода, на функциональность не влияет. Нужно добавить строку в пустой файл и еще одну перед декоратором

Попробовал запустить пример — у меня ошибок не вызвало. Если используется Venv, проверьте, что там используется именно эта версия pyTelegramBotAPI 4.7.1

Источник

Improve Article

Save Article

  • Read
  • Discuss
  • Improve Article

    Save Article

    Before fixing the unresolved reference issues, we must know why these issues occur in the first place. 

    An unresolved reference issue is raised in PyCharm IDE when:

    1. A variable is called/used outside the scope of its existence.
    2. A package is used within the code without prior installation or installed with an improper version.
    3. A function/class used within the code without importing it in the code or has an improper import path.

    PyCharm highlights these areas where the code has the issue. Hover the mouse cursor over the highlighted area and PyCharm will display an Unresolved reference.

    Let’s see some of the example scenarios of how the Unresolved reference issue occurs.

    Issue 1: Using variables out of scope.

    Unresolved reference: Variable out of scope

    Unresolved reference: Variable out of scope

    Fix: Declare the variable globally or use it only within the scope.

    Fixed: Variable out-of-scope reference issue

    Fixed: Variable out-of-scope reference issue

    Issue 2: Importing a package that has not been installed or does not have the required version containing that function/class.

    Unresolved reference: package not installed

    Unresolved reference: package not installed

    Fix: Install the package manually via the command line or click Install package <package-name> in the suggestion box. PyCharm will fetch and install the globally available packages in the current environment.

    pip install flask

    Fixed: Package installed to resolve the reference

    Fixed: Package installed to resolve the reference

    Issue 3: Using a function that has not been imported properly in the current Python file.

    File: other.py with hello() function

    File: other.py with hello() function

    Unresolved reference: path to function is incorrect

    Unresolved reference: path to function is incorrect

    Fix: Correct the line of import with the actual path to the hello() function.

    Fixed: Unresolved function import

    Fixed: Unresolved function import

    Disabling the warning altogether

    You can also disable the Unresolved references warning completely by following these steps:

    • Click on the File option in PyCharm’s menu bar.

    File option

    File option

    • Click on Settings.

    Settings

    Settings

    • In the right pane of Settings go to Editor > Inspections.

    Editor > Inspections”><figcaption>Editor > Inspections</figcaption></figure>
<ul>
<li>Expand the <strong>Python</strong> dropdown.</li>
</ul>
<div style=Python drop-down

    Python drop-down

    • Look for the Unresolved references option in the dropdown list and deselect the checkbox.

    Deselect Unresolved references

    Deselect Unresolved references

    • Click Apply button and PyCharm will disable showing the Unresolved references warning altogether.

    Apply the changes

    Apply the changes

    This is a part of PyCharm’s code Inspection feature, using which programmers can foresee the areas of code which may cause an issue during execution. PyCharm also suggests a quick resolution to most of these issues. This improves the agility of coding along with fewer errors.

    Tip: Place the caret where the issue is and press the Alt+Enter shortcut to see the suggested fixes by PyCharm.

    Table of Contents

    • 1 How do I fix unresolved reference error in Python?
    • 2 How do I resolve unresolved references in PyCharm?
    • 3 Where is reference in PyCharm?
    • 4 What does P mean in PyCharm?
    • 5 What to do if PyCharm is not opening?
    • 6 Can not setup Python SDK?
    • 7 Where is my Python SDK?
    • 8 Is IntelliJ good for Python?
    • 9 Should I get PyCharm professional or community?

    How do I fix unresolved reference error in Python?

    1. Do File -> Invalidate Caches / Restart and restart PyCharm.
    2. First, check which interpreter you’re running: Run -> Edit Configurations -> Configuration -> Python Interpreter .
    3. Refresh the paths of your interpreter:
    4. Remove the interpreter and add it again:
    5. Delete your project preferences.

    How do I resolve unresolved references in PyCharm?

    Apply a quick-fix

    1. Place the caret at an unresolved reference, PyCharm shows the red light bulb.
    2. Click the bulb, or press Alt+Enter to reveal the list of available quick fixes:

    How do I fix unresolved import in Python?

    The quick way to fix is it provide the interpreter path to the main folder. Press Command + Shift + P (or Ctrl + Shift + P on most other systems). Select the path where you installed Python in from the options available.

    Where is reference in PyCharm?

    Find usages in a project

    1. Select a symbol to find usages for. To do that, place the caret within the desired symbol in the editor, or click the symbol in the Project tool window.
    2. Do one of the following: From the main menu, select Edit | Find Usages.
    3. In the Find tool window, explore search results.

    What does P mean in PyCharm?

    This is the symbol for the type. A complete list may be found in PyCharm’s docs: c: class f: field F: function m: method p: parameter P: property v: variable. https://stackoverflow.com/questions/50022252/whats-the-meaning-of-f-and-m-in-pycharm-auto-completion/50022310#50022310.

    How do I open PyCharm settings?

    To access project structure, open Settings / Preferences dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or PyCharm | Preferences for macOS, then expand the Project node, and select Project Structure.

    What to do if PyCharm is not opening?

    This worked for me:

    1. Reboot your machine.
    2. Go into C:Usersmschmitt<Pycharm folder>systemtmp.
    3. Delete everything in there.
    4. Start PyCharm.

    Can not setup Python SDK?

    1. Find show all in the right corner of a setting icon.
    2. Click the + icon to open Add python Interpreter.
    3. In New environment ‘s Location Under Virtualenv Environment select file.
    4. Find your Pycharm file and make an empty file under it and click OK and keep click OK.
    5. Share. Share a link to this answer. Copy link CC BY-SA 4.0.

    Can I use IntelliJ for Python?

    To develop Python scripts in IntelliJ IDEA, download and install Python and configure at least one Python SDK. A Python SDK can be specified as a Python interpreter for Python project. IntelliJ IDEA supports: Standard Python interpreters.

    Where is my Python SDK?

    Navigate to File > Project Structure. Under the Project menu for Project SDK, select “New” and. Select “Python SDK”, then select “Local”.

    Is IntelliJ good for Python?

    Out of the box, IntelliJ IDEA provides a comprehensive feature set including tools and integrations with the most important modern technologies and frameworks for enterprise and web development with Java, Scala, Groovy and other languages. On the other hand, PyCharm is detailed as “The Most Intelligent Python IDE”.

    Which is better Eclipse or IntelliJ?

    IntelliJ is much easier to use as compared to Eclipse. The learning curve is far faster in IntelliJ, which makes developing easier and more natural. Code completion, Dropdowns, quick view, project wizards, etc. are all possible in both Eclipse and IntelliJ, but the user experience in IntelliJ is much more satisfying.

    So why would I use PyCharm Professional Edition? The professional edition of PyCharm gives you access to additional features that you don’t get in the community edition: Support for Remote Development. PyCharm Pro can deploy and debug python code running on remote machines, virtual machines, and Docker containers.

    How do I fix unresolved reference error in Python?

    Table of Contents

    • 1 How do I fix unresolved reference error in Python?
    • 2 Where is reference in PyCharm?
    • 3 How do I open preferences in PyCharm?
    • 4 How do I look up a function in PyCharm?
    • 5 How to fix unresolved reference issue in Python?
    • 6 Why does Python-PyCharm show unresolved references error for valid code?
    • 7 Why is my Python code still running correctly?
    • 8 Why do I get unresolved reference error in Python?
    • 9 Why is there an unresolved reference error in selenium?
    • 10 How do I fix kotlin unresolved reference?
    • 11 How does PyCharm solve type errors?
    • 12 How do I fix unresolved import?
    • 13 How to get rid of unresolved reference to schema?
    • 14 How to find the unresolved reference in Java?
    • 15 Why do I get unresolved reference errors in Kotlin?

    How do I fix unresolved reference error in Python?

    1. check for __init__.py file in src folder.
    2. add the src folder as a source root.
    3. Then make sure to add add sources to your PYTHONPATH (see above)
    4. in PyCharm menu select: File –> Invalidate Caches / Restart.

    Where is reference in PyCharm?

    Find usages in a project

    1. Select a symbol to find usages for. To do that, place the caret within the desired symbol in the editor, or click the symbol in the Project tool window.
    2. Do one of the following: From the main menu, select Edit | Find Usages.
    3. In the Find tool window, explore search results.

    What is unresolved import in Python?

    When importing your own python modules, which are in the workspace folder, but the main script is not in the root directory of the workspace folder, the imports are unresolved. There is an alternative way that you can use the command interface.

    How do I open preferences in PyCharm?

    To access project structure, open Settings/Preferences dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or PyCharm | Preferences for macOS, then expand the Project node, and select Project Structure.

    How do I look up a function in PyCharm?

    Definitions In PyCharm, you can see where and how symbols, such as tags, classes, fields, methods, or functions are defined in your project. For this purpose, the IDE features the Quick Definition popup. To view definition of a symbol, select it in the editor and press Ctrl+Shift+I (or click View | Quick Definition).

    How do you show parameters in PyCharm?

    With your cursor in the parentheses, invoke Parameter Info ( Ctrl-P Win/Linux, Cmd-P macOS.) You get a tiny popup with the positional and keyword arguments, along with any default values.

    How to fix unresolved reference issue in Python?

    This way, you don’t have to hard code things into your interpreter’s settings: Then make sure to add add sources to your PYTHONPATH under: This way, you can add whatever you want as a source root, and things will simply work. If you unmarked it as a source root however, you will get an error: After all this don’t forget to restart.

    Why does Python-PyCharm show unresolved references error for valid code?

    The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with “unresolved reference” errors, even for built-in Python functions. Why don’t these seem to be detected, even though the code runs?

    How to fix Python reference issue in venv?

    In the venv’s console you should install the packages explicitly or go in settings -> project interpreter -> add interpreter -> inherit global site-packages. then click on the “+” icon on the right side to search for the package you want and install it.

    Why is my Python code still running correctly?

    There are several reasons why this could be happening. Below are several steps that fixes the majority of those cases: Some .idea issue causing the IDE to show error while the code still runs correctly. Solution:

    Why do I get unresolved reference error in Python?

    Am using Python 3.6.5 rcs, pip version 9.0.1, selenium 3.11.0. The environment variables have been set. But the code from selenium import webdriver gives an unresolved reference error. How to fix the problem?

    How to fix unresolved references in Python PyCharm?

    Click PyCharm menu. Select Project Interpreter. Select Gear icon. Select More button. Select Project Interpreter you are in. Select Directory Tree button. Select Reload list of paths. Problem solved! you just have to mark your root directory as: SOURCE ROOT (red), and your applications: EXCLUDED ROOT (blue),

    In the venv’s console you should install the packages explicitly or go in settings -> project interpreter -> add interpreter -> inherit global site-packages. then click on the “+” icon on the right side to search for the package you want and install it.

    Why is there an unresolved reference error in selenium?

    The environment variables have been set. But the code from selenium import webdriver gives an unresolved reference error. How to fix the problem? Please log in or register to add a comment.

    How do I fix kotlin unresolved reference?

    If you still have issues, with some older plugins you need to clear the caches in Intellij IDEA (file menu, Clear Caches and Restart, select option to restart). If everything goes well , then your environment is all good to work with Kotlin .

    How do I remove unresolved references in PyCharm?

    1. Do File -> Invalidate Caches / Restart and restart PyCharm.
    2. First, check which interpreter you’re running: Run -> Edit Configurations -> Configuration -> Python Interpreter .
    3. Refresh the paths of your interpreter:
    4. Remove the interpreter and add it again:
    5. Delete your project preferences.

    How does PyCharm solve type errors?

    Configure error highlighting

    1. Press Ctrl+Alt+S to open IDE settings and select Editor | Inspections.
    2. Select the profile that you want to modify.
    3. From the list of severity levels, select Edit severities.
    4. Select the severity for which you want to change the formatting and click Edit Settings | Colors & Fonts.

    How do I fix unresolved import?

    If you are working with Visual Studio Code and import any library, you will face this error: “unresolved import”. To resolve this error, In your workspace settings, you can set your Python path like the following. Then reload the VSCode, and it will fix that error.

    How do I fix unresolved imports in Python?

    What I did to resolve this issue:

    1. Go into the workspace folder (here workspaceRootFolder) and create a . env file.
    2. In this empty . env file, add the line PYTHONPATH=codeFolder (replace codeFolder with your folder name)
    3. Add “python. envFile”: “${workspaceFolder}/. env” to the settings. json.
    4. Restart Visual Studio Code.

    How to get rid of unresolved reference to schema?

    I imported a few databases and tried to get rid of all “Errors”. Once I managed this, I tried to be more ambitious by switch the project setting “Treat Transact-SQL Warnings as Errors”.

    How to find the unresolved reference in Java?

    You must only import the ” R ” library with your application package name, in this case com.example.package.R Sometimes the library is not imported at all, to import it, click on the unresolved reference R and press Alt + Enter

    Why is my reference file missing or unresolved?

    Lack of permissions to the folder or server where the reference files are located. A circular reference is present. The referenced file has been renamed. Third-party applications (e.g. Advanced System Care), turning off DNS client, IP helper, and net logon when run. Try the following solutions:

    Why do I get unresolved reference errors in Kotlin?

    I’m new to kotlin and Andriod studio. I was following a tutorial and everything was going smoothly until I received a ton of “Unresolved reference errors” I looked at other peoples post concerning this problem but nothing seemed to help as I still receive multiple errors

    Введение

    У меня есть проект Python в репозитории git. Все работает нормально для большинства членов команды, мы можем синхронизировать код и редактировать его без каких-либо проблем с Pycharm на разных платформах (Windows, Linux)

    Проблема

    На одном из компьютеров мы получаем «Unresolved reference» по всему коду почти для каждого импорта, за исключением встроенных в Python библиотек (т.е. импортирует datetime). На этом компьютере установлена ​​версия Pycharm Mac.

    Вопрос

    Кто-нибудь знает, как это решить?, так как большая часть импорта не распознается завершением кода и навигацией через goto- > declare и т.д., не работает. Есть ли известная проблема с версией Mac?

    Спасибо заранее!

    4b9b3361

    Ответ 1

    Ключ должен указывать исходный каталог в качестве корня источника. Попробуйте следующее:

    • В представлении «Проект» щелкните правой кнопкой мыши исходный каталог Python
    • В меню диалога выберите Отметить каталог как > Корень источника

    Теперь папка должна быть синей, а не бежевой, чтобы указать, что это исходная папка Python.

    Вы также можете настроить это в настройках PyCharm, выполнив следующее для проекта, который уже находится в PyCharm:

    • На панели инструментов Mac выберите PyCharm > Настройки
    • В открывшемся окне выберите Структура проекта в панели меню слева.
    • Выберите проект в средней панели, если необходимо
    • Щелкните правой кнопкой мыши на источнике Python в правой панели и выберите Источники в диалоговом окне меню

    Ответ 2

    У меня также была проблема, и мне потребовалось несколько часов, чтобы найти точное решение.

    Вам нужно подтвердить следующее.

    • 'django.contrib.staticfiles', добавляется в INSTALLED_APPS в файле settings.py вашего приложения.

    • Каталог со статическим содержимым (например, изображениями) с именем static находится под корнем приложения.

    Теперь выполните следующие действия

    PyCharm > Настройки > Настройки проектa > Django

    Убедитесь, что ваши Django Project root, settings.py и manage.py script четко определены в диалоговом окне.

    Вы хорошо пойдете.
    Надеюсь это поможет.

    Ответ 3

    Я сделал все вышеперечисленное из einnocent и myildirim, но все равно должен был сделать следующее:

    закрыть pycharm и вручную удалить папку .idea, это удалит все, что pycharm знает о коде.

    открыть pycharm, reimport проект

    комбинация установки правильного корня источника, перезапуск python с invalide cache и удаление папки .idea/реимпорт проекта pycharm исправили его для меня.

    Ответ 4

    Я столкнулся с аналогичной проблемой с pyspark (искра 2.1) и luigi.

    Сбой попытки:

    • Настройка переменной среды PYTHONPATH
    • Недействительный кеш и перезапуск pycharm
    • Отметьте каталог как Корень источника

    Неразрешенная ссылка pyspark может быть исправлена ​​путем добавления каталога искрового питона в Content Root в проекте, но запуск проекта в качестве задачи luigi дал та же ошибка.

    Успешные шаги

    • Создайте пустой __init__.py файл в проекте
    • Включите следующие строки кода вверху script

      ...
      import sys
      
      sys.path.append("/path/to/spark/python")
      
      sys.path.append("/path/to/spark/python/lib")
      
      ...
      // import pyspark files after above mentioned lines
      

    и нерешенной проблемой ссылка ошибка была исправлена ​​как в PyCharm и задачи LuiGi.

    Ответ 5

    Другой причиной может быть проектный интерпретатор. Например, если вы используете Python3.x, но интерпретатор предназначен для Python2.x. Вы можете проверить здесь:

    Файл | Настройки | Проект: ‘projectname’ | Переводчик проекта

    Ответ 6

    PyCharm — Alt-F (ile); Настройки; Структура проекта; нажмите + добавить корневой контент;
    укажите свою папку, содержащую пакет, в конфликте:/home/joker/anaconda3/envs/conda_py27/lib/python2.7/site-packages.
    Я дополнительно отмечен как ресурсы (не уверен, что это обязательно). Нажмите «ОК», и произойдет переиндексация.
    Эта решила проблему для меня в PyCharm Professional 2016.2.3

    Ответ 7

    Моя десятка — Если вы работаете с виртуальными средами (у вас есть каталог venv), убедитесь, что он помечен как исключенный.

    Плагиат сверху:

    • В представлении «Проект» щелкните правой кнопкой venv каталог venv
    • В диалоговом меню выберите Пометить каталог как > исключенный

    Каталог должен стать оранжевым…

    Это иногда случается, если вы сделали git clean или по какой-то причине вам пришлось перестраивать вашу среду, а PyCharm не заметил

    Понравилась статья? Поделить с друзьями:
  • Python unindent does not match any outer indentation level ошибка
  • Python unicode error unicodeescape codec can t decode bytes in position
  • Python unicode error pandas
  • Python try except вывести текст ошибки
  • Python try except все ошибки