Get the App
SLTechnology News&Howtos  ›  Servers  › 

The solution that pycharm can't import classes under Ubuntu

Shulou Source: shulou.com Published: 2022-06-02 01:20:14 11月16日 Update

Recently, after learning the flask framework of Python and configuring the environment, I ran "hello.py" on the terminal without any problems, but when I opened it with pycharm, I found that there was something wrong with the code and could not import the Flask class. The detailed error information is 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 running result of the terminal.

Terminal result

It took a long time for Baidu to find a solution from the Internet. I hope it can help you here.

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

Open the terminal

Then enter it at the terminal

Pip install flask

Install flask

The great task has been completed

Running result

Note:

This solution, in fact, is in the pycharm terminal, re-installed flask; but I do not quite understand why, in the Windows environment through the pip installation of the package, in the pycharm can be directly imported, may be because this is in the Linux environment, or because I previously configured the environment, the configuration is a virtual environment. If any boss reads this blog, I hope you can give me some advice and leave an answer in the comments section.

The above Ubuntu pycharm can not import classes under the solution is the editor to share with you all the content, I hope to give you a reference, but also hope that you support more.

Tags: Terminal environment result configuration method that is error run method good generous advice done code information content blog reason icon picture great achievement Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MariaDB Docker macOS Shulou Tech Info