Solution to pycharm unable to import classes under Ubuntu

Recently, I was learning Python flask framework. After configuring the environment, I ran "hello.py" in the terminal. The effect was good. There was nothing wrong with it; but when I opened it with pycharm, I found that the code was wrong, and the Flask class could not be imported. The detailed error Message as follows:

This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing,this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.

Error details

This is the result of running the terminal

Terminal result

It took a long time to find a solution from Baidu on the Internet. Here is a summary. Hope to help you

First, open the terminal (click on the "Terminal" icon in the picture)

Open terminal

Then type in the terminal

pip install flask

Install flask

You're done

operation result

Note:

This solution is actually to reinstall flask on the pycharm terminal; but I don’t really understand why this is done. The package installed via pip in the Windows environment can be directly imported in pycharm, maybe Because this is the reason in the Linux environment, it may also be because when I configured the environment before, I configured the virtual environment. If anyone sees this blog, I hope they can give me advice and leave an answer in the comment area.

The above solution for pycharm unable to import classes under Ubuntu is all the content shared by the editor, I hope to give you a reference.

Recommended Posts

Solution to pycharm unable to import classes under Ubuntu
Solution for Ubuntu unable to connect to the network
The solution to the failure to install .deb under Ubuntu 16.04
How to compile ijkplayer-android under ubuntu
How to install Audacious under Ubuntu
How to install Tensorflow under ubuntu 16.04
Pycharm calls Hanlp practice sharing under ubuntu
Solution to ubuntu unable to surf the Internet after plugging in the network cable
Use mendeley to insert references under ubuntu
Solution for Postgresql uninstall error under Ubuntu
Three ways to install software under Ubuntu
How to change MySQL password under Ubuntu
How to install Pycharm and Ipython on Ubuntu 16.04/18.04
Summary of methods to use Evernote under Ubuntu 14.04
Use rsync to remotely backup data under Ubuntu
Explain the solution to the Ubuntu 16.04 launcher icon exception
Use doxygen to generate API documentation under Ubuntu 12.04
Publish the node.js project under Ubuntu to heroku
Steps to add toolkit for Matlab_Linux under ubuntu
Add a new project to SVN under Ubuntu
How to enable Mysql remote access under Ubuntu 14.04
How to install gcc compiler faster under Ubuntu
How to repackage Deb files under Debian and Ubuntu
Solution to the virtual machine ubuntu16.04 cannot connect to the Internet
Solution to the slow speed of ubuntu18.04 wireless network
How to open https on nginx server under Ubuntu