Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.4k views
in Technique[技术] by (71.8m points)

python 2.7 - DLL load failed with PyQGIS

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...