I have installer QGIS via osgeo4w 32 bit yesterday and I want to take pyqgis api in standalone script but I have some problems. first I have python 2.7.13 32bit and I have install pyqt4 from Gohlke . second I create a file (qgis.pth) and I put in python27/Lib/site-packages to get the path for QGIS api. paths : C:\OSGeo4W\apps\Python27 C:\OSGeo4W\apps\Python27\libs C:\OSGeo4W\apps\Python27\Lib C:\OSGeo4W\apps\Python27\DLLs C:\OSGeo4W\apps\qgis\bin C:\OSGeo4W\apps\qgis\grass\bin C:\OSGeo4W\apps\qgis\grass\modules C:\OSGeo4W\apps\qgis\grass\scripts C:\OSGeo4W\apps\qgis\i18n C:\OSGeo4W\apps\qgis\python C:\OSGeo4W\apps\qgis\python\console C:\OSGeo4W\apps\qgis\resources C:\OSGeo4W\bin C:\OSGeo4W\bin\gdalplugins C:\OSGeo4W\bin\osgPlugins-3.1.7 C:\OSGeo4W\etc\ini C:\OSGeo4W\etc\postinstall C:\OSGeo4W\etc\preremove C:\OSGeo4W\include\geos C:\OSGeo4W\lib (and if I add the paths from QGIS pyqt4 and sip I take again some errors) now the problems : first test : import qgis.core error : import qgis.core File "C:\OSGeo4W\apps\qgis\python\qgis\__init__.py", line 26, in <module> from qgis.PyQt import QtCore File "C:\OSGeo4W\apps\qgis\python\qgis\PyQt\QtCore.py", line 38, in <module> from PyQt4.QtCore import QPyNullVariant ImportError: cannot import name QPyNullVariant second test : from PyQt4.QtCore import * from PyQt4.QtGui import * #from PyQt4.QtSvg import * #from PyQt4.QtCore import pyqtSignal as Signal #from PyQt4.QtCore import pyqtSlot as Slot import qgis.core error : sip.setapi(api, 1) ValueError: API 'QDate' has already been set to version 2 and finaly y try this code : import sip API_NAMES = ["QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl", "QVariant"] API_VERSION = 2 for name in API_NAMES: sip.setapi(name, API_VERSION) from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtSvg import * from PyQt4.QtCore import pyqtSignal as Signal from PyQt4.QtCore import pyqtSlot as Slot import qgis.core error if version=1 from PyQt4.QtCore import QPyNullVariant ImportError: cannot import name QPyNullVariant if version is 2 : from PyQt4.QtCore import QPyNullVariant ImportError: cannot import name QPyNullVariant any idea ?if remove the import for QGIS then I don't take some error with imports for sip ot pyqt only if I try to import PYQGIS