简体   繁体   中英

PyCharm can't resolve references to PyQT5 modules

I'm trying to learn how to use PyQT5. I created a new folder under my user profile and spun up a virtualenv (and installed PyQT5 from pip3) in a folder called env . I created the project in another folder called guis and pointed PyCharm to the env environment. Pycharm can't find the submodules but sees PyQT5.QtWidgets just fine.

Screnshot: 在此输入图像描述

I got it to work by removing PyQT5 from

Settings > Project > Project Interpreter

and reinstalling it within PyCharm .

Restart PyCharm afterwards.

我不得不去File --> Invalidate Caches / Restart

In my case i had non-latin symbols in path to python (in AppData). I made new windows user with only-latin name, using it instead of original user fixed the problem.

setting -> project interpreter -> click setting icon -> add -> new environment -> ( add path) -> check 'inherit global site-packages' and 'make available to all projects' -> click OK

always use same environment or you can use different environment for different projects, just check global packages

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