Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pycharm, PyQt5, and Python 2.7 -- No code completion

I've got:

  • Python 2.7 (Anaconda x64), which works great
  • PyQt5 (installed using pip install python-qt5)
  • PyCharm 4.04 Professional (recently upgraded from 3.4.1)
  • A small Qt application

After much hair-pulling (since Riverbank doesn't provide a PyQt5 binary for Python 2.7, only for 3.3+) I got everything working thanks to Marcus Otosson's pre-compiled binary packages.

Qt is now installed and fully functional. My Qt application runs great!

But the application isn't finished yet, and PyCharm won't do code completion for the PyQt modules. It won't even recognize that any PyQt5 sub-modules (like Qwidgets) exist: even though they work just fine, I still get the red squiggly "Unresolved Reference" warning.

How do I fix this? I assume this has to do with the inherent difficulties in generating skeletons for binary *.pyd files. How does it work exactly? Can I manually generate code skeletons, or import them from somewhere they generated correctly?

Uninstalling and re-installing PyCharm didn't help. Neither did re-configuring the interpreter to force the skeleton generator to run again.

Please help before I go bald.

like image 982
Matt Merrifield Avatar asked Jan 29 '15 02:01

Matt Merrifield


People also ask

Why Autocomplete is not working in PyCharm?

You need to go into the project settings and configure the interpreter to point at the virtualenv. PyCharm will then index the interpreter and allow you to autocomplete. The virtualenv may be auto-detected in the dropdown menu on the left.

How do I enable code completion in PyCharm?

Press Ctrl+Space or choose Code | Code Completion | Basic from the main menu. If necessary, press Ctrl+Space for the second time (or press Ctrl+Alt+Space ).

What is the shortcut key in PyCharm to auto complete?

The suggestion list of Automatic completion appears as soon as you start typing a new identifier. The suggestion list of Basic completion appears when you press Ctrl+Space .

How do I fix PyCharm?

From the main menu, select File | Repair IDE. PyCharm will automatically launch the first recovery step and refresh the virtual file system. PyCharm will display a notification that you can use to continue or complete the recovery process.


1 Answers

Can you find PyQt5 from your project's External Libraries? If you install it through pip, you should be able to see the library directly. Once the library can be referred, it will do the code-completion for you.

like image 138
Ellis Shen Avatar answered Oct 01 '22 19:10

Ellis Shen