Вопрос

it seems I can't find a way to enable autocompletion for PyQt5 in Eclipse using PyDev 2.8. I'm running Mac OS 10.9 Mavericks.

While installing PyQt5 I noticed that there weren't '.py' modules installed in the default library paths for PyQt5 but only '.sip' files. Can this be the cause of the problem? If yes, does exist a workaround?

Example:

from PyQt5.QtCore import *
QA #here I'd expect QApplication appear as suggestion but it doesn't

Note: this is just an example. Autocompletion does not show any of the modules, classes, method, functions or whatever from PyQt5.

The following is the value of the PYTHONPATH variable:

macbookpro:~ giovanni$ echo $PYTHONPATH
:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

And here the listing of files and dirs there:

macbookpro:site-packages giovanni$ ls -haltR
total 0
drwxr-xr-x   26 root  wheel   884B  6 Dic 12:51 PyQt5
drwxr-xr-x    3 root  wheel   102B  6 Dic 12:51 .
drwxr-xr-x  649 root  wheel    22K  6 Dic 12:51 ..

./PyQt5:
total 36408
drwxr-xr-x  26 root  wheel   884B  6 Dic 12:51 .
-rwxr-xr-x   1 root  wheel    12K  6 Dic 12:51 Qt.so
-rwxr-xr-x   1 root  wheel   440K  6 Dic 12:51 QtDesigner.so
-rwxr-xr-x   1 root  wheel   207K  6 Dic 12:51 QtXmlPatterns.so
-rwxr-xr-x   1 root  wheel   280K  6 Dic 12:51 _QOpenGLFunctions_2_0.so
-rw-r--r--@  1 root  wheel   826B  6 Dic 12:51 __init__.py
drwxr-xr-x@ 15 root  wheel   510B  6 Dic 12:51 uic
-rwxr-xr-x   1 root  wheel    95K  6 Dic 12:51 QtSerialPort.so
-rwxr-xr-x   1 root  wheel   379K  6 Dic 12:51 QtSql.so
-rwxr-xr-x   1 root  wheel   128K  6 Dic 12:51 QtSvg.so
-rwxr-xr-x   1 root  wheel   116K  6 Dic 12:51 QtTest.so
-rwxr-xr-x   1 root  wheel   211K  6 Dic 12:51 QtWebKit.so
-rwxr-xr-x   1 root  wheel   358K  6 Dic 12:51 QtWebKitWidgets.so
-rwxr-xr-x   1 root  wheel   5,8M  6 Dic 12:51 QtWidgets.so
-rwxr-xr-x   1 root  wheel   729K  6 Dic 12:51 QtMultimedia.so
-rwxr-xr-x   1 root  wheel   137K  6 Dic 12:51 QtMultimediaWidgets.so
-rwxr-xr-x   1 root  wheel   861K  6 Dic 12:51 QtNetwork.so
-rwxr-xr-x   1 root  wheel   153K  6 Dic 12:51 QtOpenGL.so
-rwxr-xr-x   1 root  wheel   266K  6 Dic 12:51 QtPrintSupport.so
-rwxr-xr-x   1 root  wheel   595K  6 Dic 12:51 QtQml.so
-rwxr-xr-x   1 root  wheel   920K  6 Dic 12:51 QtQuick.so
-rwxr-xr-x   1 root  wheel   327K  6 Dic 12:51 QtSensors.so
drwxr-xr-x   3 root  wheel   102B  6 Dic 12:51 ..
-rwxr-xr-x   1 root  wheel   2,7M  6 Dic 12:51 QtCore.so
-rwxr-xr-x   1 root  wheel   3,0M  6 Dic 12:51 QtGui.so
-rwxr-xr-x   1 root  wheel   148K  6 Dic 12:51 QtHelp.so

./PyQt5/uic:
total 200
drwxr-xr-x@ 15 root  wheel   510B  6 Dic 12:51 .
drwxr-xr-x  26 root  wheel   884B  6 Dic 12:51 ..
drwxr-xr-x@  9 root  wheel   306B  6 Dic 12:51 Compiler
drwxr-xr-x@  5 root  wheel   170B  6 Dic 12:51 Loader
-rw-r--r--@  1 root  wheel   8,5K  6 Dic 12:51 __init__.py
-rw-r--r--@  1 root  wheel   4,0K  6 Dic 12:51 driver.py
-rw-r--r--@  1 root  wheel   2,1K  6 Dic 12:51 exceptions.py
-rw-r--r--@  1 root  wheel   5,0K  6 Dic 12:51 icon_cache.py
-rw-r--r--@  1 root  wheel   5,3K  6 Dic 12:51 objcreator.py
drwxr-xr-x@  9 root  wheel   306B  6 Dic 12:51 port_v2
drwxr-xr-x@  9 root  wheel   306B  6 Dic 12:51 port_v3
-rw-r--r--@  1 root  wheel    18K  6 Dic 12:51 properties.py
-rw-r--r--@  1 root  wheel   2,7K  6 Dic 12:51 pyuic.py
-rw-r--r--@  1 root  wheel    35K  6 Dic 12:51 uiparser.py
drwxr-xr-x@  7 root  wheel   238B  6 Dic 12:51 widget-plugins

./PyQt5/uic/Compiler:
total 104
drwxr-xr-x@  9 root  wheel   306B  6 Dic 12:51 .
drwxr-xr-x@ 15 root  wheel   510B  6 Dic 12:51 ..
-rw-r--r--@  1 root  wheel   1,0K  6 Dic 12:51 __init__.py
-rw-r--r--@  1 root  wheel   4,4K  6 Dic 12:51 compiler.py
-rw-r--r--@  1 root  wheel   2,7K  6 Dic 12:51 indenter.py
-rw-r--r--@  1 root  wheel   2,5K  6 Dic 12:51 misc.py
-rw-r--r--@  1 root  wheel   4,2K  6 Dic 12:51 proxy_metaclass.py
-rw-r--r--@  1 root  wheel   5,5K  6 Dic 12:51 qobjectcreator.py
-rw-r--r--@  1 root  wheel    16K  6 Dic 12:51 qtproxies.py

./PyQt5/uic/Loader:
total 32
drwxr-xr-x@  5 root  wheel   170B  6 Dic 12:51 .
drwxr-xr-x@ 15 root  wheel   510B  6 Dic 12:51 ..
-rw-r--r--@  1 root  wheel   1,0K  6 Dic 12:51 __init__.py
-rw-r--r--@  1 root  wheel   3,0K  6 Dic 12:51 loader.py
-rw-r--r--@  1 root  wheel   4,9K  6 Dic 12:51 qobjectcreator.py

./PyQt5/uic/port_v2:
total 56
drwxr-xr-x@  9 root  wheel   306B  6 Dic 12:51 .
drwxr-xr-x@ 15 root  wheel   510B  6 Dic 12:51 ..
-rw-r--r--@  1 root  wheel   1,0K  6 Dic 12:51 __init__.py
-rw-r--r--@  1 root  wheel   1,4K  6 Dic 12:51 as_string.py
-rw-r--r--@  1 root  wheel   1,3K  6 Dic 12:51 ascii_upper.py
-rw-r--r--@  1 root  wheel   1,5K  6 Dic 12:51 invoke.py
-rw-r--r--@  1 root  wheel   1,5K  6 Dic 12:51 load_plugin.py
-rw-r--r--@  1 root  wheel   1,2K  6 Dic 12:51 proxy_base.py
-rw-r--r--@  1 root  wheel   1,1K  6 Dic 12:51 string_io.py

./PyQt5/uic/port_v3:
total 56
drwxr-xr-x@  9 root  wheel   306B  6 Dic 12:51 .
drwxr-xr-x@ 15 root  wheel   510B  6 Dic 12:51 ..
-rw-r--r--@  1 root  wheel   1,0K  6 Dic 12:51 __init__.py
-rw-r--r--@  1 root  wheel   1,4K  6 Dic 12:51 as_string.py
-rw-r--r--@  1 root  wheel   1,3K  6 Dic 12:51 ascii_upper.py
-rw-r--r--@  1 root  wheel   1,5K  6 Dic 12:51 invoke.py
-rw-r--r--@  1 root  wheel   1,5K  6 Dic 12:51 load_plugin.py
-rw-r--r--@  1 root  wheel   1,2K  6 Dic 12:51 proxy_base.py
-rw-r--r--@  1 root  wheel   1,0K  6 Dic 12:51 string_io.py

./PyQt5/uic/widget-plugins:
total 40
drwxr-xr-x@  7 root  wheel   238B  6 Dic 12:51 .
drwxr-xr-x@ 15 root  wheel   510B  6 Dic 12:51 ..
-rw-r--r--@  1 root  wheel   1,5K  6 Dic 12:51 qaxcontainer.py
-rw-r--r--@  1 root  wheel   1,5K  6 Dic 12:51 qscintilla.py
-rw-r--r--@  1 root  wheel   1,5K  6 Dic 12:51 qtdeclarative.py
-rw-r--r--@  1 root  wheel   1,6K  6 Dic 12:51 qtprintsupport.py
-rw-r--r--@  1 root  wheel   2,4K  6 Dic 12:51 qtwebkit.py
Это было полезно?

Решение 2

I've finally found PySide which is a binding to the QT libraries. It's released under the MIT license and work well in tandem with PyDev 2.8 and Eclipse Kepler on Mac OS 10.9.3.

Другие советы

It seems things are in place... PyDev 2.8.x did have some issues on setting the PYTHONPATH when things changed, so, ideally, please try the nightly build (see: http://pydev.org/download.html for details on getting it) and see if it fixes things for you.

Note that on PyDev 3.x you need to point Eclipse to use a Java 7 JVM (some users seem to have issues on making Eclipse use it the proper java vm, especially on Mac OS -- if you have this problem, maybe you can check LiClipse 0.9.0 -- which is mostly a distribution of PyDev standalone + some other niceties + a way to directly support PyDev -- and it has PyDev 3 builtin -- otherwise, take a look at https://stackoverflow.com/a/20477000/110451 for instructions on how to configure it).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top