I'm using Winpython 3.6.7 and I want to create a standalone application using QGIS 3.4.11. When I append the QGIS path using the
sys module, nothing happens.
import sys sys.path.append("C:\OSGeo4W64\apps\Python37\lib") import qgis.core >>> ModuleNotFoundError: No module named 'qgis
Previously when I wanted to work with PyQGIS 2.x (built-in Python), I created a batch file to familiarize my IDE with QGIS and set PATH and PYTHONPATH variables to QGIS
\python. e.g. Something like this for Pycharm IDE:
SET OSGEO4W_ROOT=C:\OSGeo4W64 SET QGISNAME=qgis-ltr SET QGIS=%OSGEO4W_ROOT%\apps\%QGISNAME% SET QGIS_PREFIX_PATH=%QGIS% SET PYCHARM="C:\Program Files\JetBrains\PyCharm Community Edition 2017.1.4\bin\pycharm64.exe" CALL %OSGEO4W_ROOT%\bin\o4w_env.bat CALL %OSGEO4W_ROOT%\bin\gdall6.bat SET PATH=%PATH%;%QGIS%\bin SET PYTHONPATH=%QGIS%\python;%PYTHONPATH% start "PyCharm aware of QGIS" /B %PYCHARM% %*
But now that I have to use Winpython and I want to import QGIS modules to it, this doesn't work. Basically, how we can integrate different python distributions to use QGIS library while enjoying full functionality? (To add some QGIS functionalities to a previously developed standalone application, for instance)
And yes, I know it's counter-intuitive to use another Python distribution (WinPython 3.6.7) other than the Python which is shipped with QGIS. But in this case, I have to. I would be delighted to see your suggestions.