I follow this [instruction][1] to create a standalone script in pycharm. The thing I do differently is I download standalone installer not the network installer. Code is from [pyqgis_developer_cookbook][2]. from qgis.core import * QgsApplication.setPrefixPath(r"C:\Program Files\QGIS 3.4\apps\qgis", True) qgs = QgsApplication([], False) qgs.initQgis() qgs.exitQgis() But when it runs to "qgs = QgsApplication([], False)" , a error pops up. [![enter image description here][3]][3] Please tell me how to solve this, thanks. [1]: http://spatialgalaxy.net/2018/02/13/quick-guide-to-getting-started-with-pyqgis3-on-windows/ [2]: https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html#id7 [3]: https://i.sstatic.net/qFtOB.jpg