6

I've just changed to QGIS 3 and I can't figure out why I can't change from Python 2.7 to Python 3.6 in PyCharm, keep getting invalid SDK! I run this .bat-file:

SET OSGEO4W_ROOT=C:\OSGeo4W64
SET QGISNAME=qgis
SET QGIS=%OSGEO4W_ROOT%\apps\%QGISNAME%
SET QGIS_PREFIX_PATH=%QGIS%
SET PYCHARM="C:\Program Files\JetBrains\PyCharm 2017.1.2\bin\pycharm64.exe"

CALL %OSGEO4W_ROOT%\bin\o4w_env.bat

SET PATH=%PATH%;%QGIS%\bin
SET PYTHONPATH=%QGIS%\python;%PYTHONPATH%

start "PyCharm aware of QGIS" /B %PYCHARM% %*
7

I figure it out!

CALL %OSGEO4W_ROOT%\bin\o4w_env.bat called on all .bat files in %OSGEO4W_ROOT%\etc\ini\ and there is the file: python-core.bat

So by changing from python27 to python36 in C:\osgeo4w64\etc\ini\python-core.bat Pycharm find all dependencies :)

EDIT 2018-02-19: After a while away from qgis-master I went back today and had some problems with getting Pycharm working, then I found this post! Really nice and updated!

  • There is no need to change anything from QGIS batch files because it will create complications. You can simply add a SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python36 line to your batch file and it will change Python26 to 36 or 37 in some versions. – Afshin Salehi Oct 1 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.