简体   繁体   中英

Pylint error: no name in module when import a package

I'm learning a little bit how function python, more specific Flask.

I'm creating a new project using flask , but when I create a new file and import Flask I receive this error: No name 'Flask' in module 'flask'pylint(no-name-in-module)

I did read that, I need create a file called: __init__.py but I have this and the error keeps showing up.

This is my actual code (very simple code, and folder/files structure): 在此处输入图像描述

Thanks for the help: :D

I tried this: Flask ImportError: No Module Named Flask , but this solution does not works for me.

在此处输入图像描述

在此处输入图像描述

I solved this changing my python interpreter. I did uninstall pylint and install pylama and now all is fine!

I installed flask on python 2.7 and run simple hello world script and it worked fine. Then I updated python to python 3.8 and I got an error similar to yours:

Unable to import 'flask'pylint(import-error)

I simply uninstalled flask and installed again and it worked for me. Run this two commands:

pip uninstall flask
pip install flask

Then export the FLASK_APP environment variable and run flask

set FLASK_APP=file.py
flask run

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