[Qgis-user] How to set PyQGIS imported in VS Code in Windows for a Python file?

PIERRE Sylvain sylvain.pierre at alsace.eu
Mon Mar 13 00:55:40 PDT 2023


Hi,

Did you set these variable in env file in your user .vscode dir ?


De : QGIS-User <qgis-user-bounces at lists.osgeo.org> De la part de LI, Xin Stephen [MIT] via QGIS-User
Envoyé : lundi 13 mars 2023 07:30
À : qgis-user at lists.osgeo.org
Objet : [Qgis-user] How to set PyQGIS imported in VS Code in Windows for a Python file?

Soyez vigilant : ce courriel provient d'une organisation externe à la CeA.
• Assurez-vous d’abord qu’il ne s’agit pas d’un email malveillant avant de cliquer sur tout lien ou pièce jointe.
Apprendre à reconnaître un email de phishing.<https://intranet.alsace.eu/actualites/apprenez-a-reconnaitre-un-email-phishing/>
The OS is Windows 10,
The QGIS version is 3.28 LTR
The Python version is 3.11

The steps following the steps in stection 1.4.1 for the PyQGIS Cookbook (GQIS Testing), i.e. https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html#python-applications
The “PAHT” and “PYTHONPYTHON” have been added.

The problem is:
When  running the Python program file with “import qgis.core”, there is the error
“ModuleNotFoundError: No module named 'qgis' ”

Moreover, after reinstalling the Python 3.9.5 as the QGIS related, then run the Python file in VS Code by Python 3.9.5, the Error is the same.

Any suggestions could help modify this setting?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20230313/1c523fa0/attachment.htm>


More information about the QGIS-User mailing list