On Windows, Python packages are installed to Python's installation directory in Lib\site-packages (e.g. C:\Python33\Lib\site-packages\PyQt4). Scripts install to the "Scripts" directory (e.g. C:\Python33\Scripts). The installer should have also created a shortcut to Qt Designer in the Start menu.
Imports are case sensitive even on Windows:
from PyQt4 import QtCore
For the pyuic
command, there's a batch file named pyuic4.bat in the package directory. Personally I'd skip on this1. The actual script is PyQt4\uic\pyuic.py. I'd use a Windows shortcut2, or use an NTFS symlink3 created with cmd's mklink
or Python's os.symlink
. You could also just copy the script, but that's a problem if the original gets updated.
1. A batch file's Ctrl-C
handler is an annoying prompt that's only relevant to actual batch processing.
2. To use the shortcut like a normal command, just add the .LNK
file extension to the PATHEXT
environment variable. Here's the way to create a simple shortcut in Python (requires PyWin32):
import win32com.client
ws = win32com.client.Dispatch('wscript.shell')
shortcut = ws.CreateShortcut('SHORTCUT_NAME.lnk')
shortcut.TargetPath = r'"PATH\TO\TARGET"'
shortcut.Save()
3. Creating symbolic links requires NT 6.0+ and SeCreateSymbolicLinkPrivilege
. Check whoami /priv
to see whether your account has the privilege. Accounts in the Administrators group have the privilege, but require access token elevation if UAC is enabled. Regular users can be granted the privilege.