简体   繁体   中英

Pylint import could not be resolved

I develop on WSL ubuntu with vscode and python3.10. I installed tweepy but vscode returns this error, and this does not allow suggestions by pressing CTRL+BACKSPACE. The error is as follows: 在此处输入图像描述

The interpreter is already set to python3.10, and in setting.json I have this:

{
    "python.linting.pylintEnabled": false,
    "python.linting.enabled": true
}

This problem occurs every time, and I really don't know how to solve it, would you have any ideas about this? Even trying to change python version there is no change.

These are the python-related extensions installed: Python, Pylance, IntelliCode

If I try to run the code (with python3.10) I get the error: ModuleNotFoundError: No module named 'tweepy', this problem, however, does not occur in python3.7

Both Pylance and Python say that tweepy isn't installed. That means it's almost certainly not installed in the environment you're using.

It sounds like there are multiple Python installations or virtual environments on your machine. My guess is that the one with Python 3.7 has tweepy and the one with Python 3.10 does not. To find out more, we'd need to know how you installed Python and its different versions. There are many ways to do that and they have little in common.

However, that's probably not necessary: just switch to the Python 3.10 environment and install tweepy the same way you did before, eg with pip install tweepy if you usually use pip for installing modules from PyPI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM