PyCharm can't resolve references to PyQT5 modules

China☆狼群 提交于 2020-01-15 10:15:52

问题


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:


回答1:


I got it to work by removing PyQT5 from

Settings > Project > Project Interpreter

and reinstalling it within PyCharm.

Restart PyCharm afterwards.




回答2:


I had to go to File --> Invalidate Caches / Restart as well




回答3:


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.




回答4:


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



来源:https://stackoverflow.com/questions/37587125/pyqt5-and-pycharm-unresolve-references

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!