Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've already asked this question in the "gis.stackexchange" forum, but it seems to be more appropriate for this one.

I am having problems with Python Shell importing the module "qgis.core". When I type "import qgis.core" the Shell ("idle.pyw") gives me this error:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import qgis.core
ImportError: DLL load failed: Impossibile trovare il modulo specificato (Trad "Impossible to find the specified module").

I have already set the environment to point the right folders following "PyQGIS cookbook" instructions. In my case, the paths are:

PYTHOPATH=C:"QGIS_path"appsqgispython; Path=C:"QGIS_path"appsqgisin.

Am I missing something? What are supposed to be the right libraries the Shell is unable to find? I am working with windows 7 64 bit, QGIS Lisboa (version 1.8), Python 2.7.2 (the one that is included in the QGIS package).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.5k views
Welcome To Ask or Share your Answers For Others

1 Answer

I do not like to mix my python installations, so I add the paths on the fly.
The paths you need are below:

import sys
sys.path.extend([r"C:Program FilesQGIS Valmieraapps",r"C:Program FilesQGIS Valmieraappsqgisin",r"C:Program FilesQGIS ValmieraappsPython27"])

import qgis.core

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...