0

I'm working with pycharm 3.7 on win 8.1 with anaconda. Im trying to import qgis with no success. after reading this link I succeeded to import qgis when runing python from terminal but not from IDE. It's happen after reading python-qgis.bat from terminal and then execute python from the terminal as well.

phthon-qgis.bat:

@echo off
call "%~dp0\o4w_env.bat"
call qt5_env.bat
call py3_env.bat
@echo off
path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH%
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis
set GDAL_FILENAME_IS_UTF8=YES 
rem Set VSI cache to be used as buffer, see #6448
set VSI_CACHE=TRUE
set VSI_CACHE_SIZE=1000000
set PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python;%PYTHONPATH%
"%PYTHONHOME%\python" %*

I tried also to add this file path as an enviroment variable in pycharm but it change nothing.

how can I import qgis from my ide?

  • read this post anitagraser.com/2019/03/03/… – Fran Raga Aug 4 '19 at 18:20
  • Thnaks, but I'm not sure that it helps. now i've got errors says "No module named '_tkinter'" and also for matplotlib.pyplot as plt, switch_backend(rcParams["backend"]) and import tkinter as Tk...it seems that if I fix the qgis problem, the tkinter show up and vice versa..any ideas? – Roy Ancri Aug 4 '19 at 20:56
  • You missed to launch pycharm. – SIGIS Aug 5 '19 at 5:53
  • @SIGIS what do you mean? I added the lines that start pycharm at the end of the .bat file and also create geosw interpeter throw pycharm – Roy Ancri Aug 5 '19 at 11:34

Your Answer

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

Browse other questions tagged or ask your own question.