-1

I want to use PyQt4 and sip in a shared maya script. I figured I can't use pip-install because I would only get these modules locally on my machine. I manually extracted these folders into my script directory. I can import both PyQt4 and sip but I can't run any commands from the modules "QtGui, QtCore" and so on. Is it possible to do it this way or do I have to install these modules? If so what is another solution to use PyQt4 in a shared script? Here are some import scripts I tried:

import sys
from python_modules.sip import *
from python_modules.PyQt4 import *

app = QtGui.QApplication(sys.argv)

Gives error:

'module' object has no attribute 'QApplication'

I Also added _.init._.py to python_libraries, sip & PyQt4 folders.

Tireless22
  • 31
  • 3

2 Answers2

2

For every version of maya, there is a page in around the corner explaining how to install PyQt for maya as maya is using a custom python package "mayapy", the install is a bit painfulbut...

around the corner

Also, it has been few versions of maya which embbed PySide, it might be easier than installing PyQt on every machine depending of your privileges.

DrWeeny
  • 2,487
  • 1
  • 14
  • 17
  • Pyside Qt was a really good suggestion! Already working in maya and basically does the same things as pyQt5. Thanks! – Tireless22 Oct 07 '19 at 11:43
0

PyQt is not just a simple python module, but a binding (usually requires to be installed to work as expected).
While theoretically it could be possible to "copy" all the needed files, you would probably always face some issues, expecially if the Qt version doesn't match (possibly for different Maya versions) or different OSs are used.

So, it's better to install PyQt on every machine, maybe using a script.

musicamante
  • 41,230
  • 6
  • 33
  • 58