Hi, Sylvain,

Thanks for your suggestions.

Is the  qgis-bin.env file  in the GQIS/bin dir?

It includes
PATH=C:\OSGeo4W\apps\qgis\bin;


From: PIERRE Sylvain <sylvain.pie...@alsace.eu>
Sent: 2023年3月13日 4:03 PM
To: PIERRE Sylvain <sylvain.pie...@alsace.eu>; LI, Xin Stephen [MIT] 
<stephe...@eduhk.hk>
Cc: qgis-user@lists.osgeo.org
Subject: RE: How to set PyQGIS imported in VS Code in Windows for a Python file?


CAUTION: External email. Do not click links or open attachments unless you 
recognise the sender and know the content is safe.
警告:外來電郵。 如不認識寄件者,或不確定內容是否安全,切勿按下任何連結或開啟任何附件。
Oops ! it’s in .env file and it looks like this for me :

PATH=$PATH;"C:\Program Files\QGIS 3.16.16\bin\";"C:\Program Files\QGIS 
3.16.16\apps\qgis\bin"
PYTHONPATH="C:\Program Files\QGIS 3.16.16\apps\qgis\python"
PYTHON_VERSION=Python39

[cid:image005.jpg@01D9567D.5045C230]
Sylvain PIERRE
Chef de projet système d’information
Direction des Systèmes d’Information et du Développement Numérique
Service Projets et Ingénierie Numérique
Collectivité européenne d’Alsace
Tél : 03 88 76 68 88
sylvain.pie...@alsace.eu<mailto:sylvain.pie...@alsace.eu>
www.alsace.eu<https://protect2.fireeye.com/v1/url?k=31323334-501cfaeb-3130cb80-454455535732-c7ed558dc3d755a3&q=1&e=4861685e-e8b2-49a8-9282-17cb5134c3f5&u=http%3A%2F%2Fwww.alsace.eu%2F>
[facebook]<https://protect2.fireeye.com/v1/url?k=31323334-501cfaeb-3130cb80-454455535732-9ee20224e4c9d4f6&q=1&e=4861685e-e8b2-49a8-9282-17cb5134c3f5&u=http%3A%2F%2Fwww.facebook.com%2Ftoutelalsace>
 [twitter] <http://www.twitter.com/toutelalsace>  [insta] 
<http://www.instagram.com/toutelalsace>

De : QGIS-User 
<qgis-user-boun...@lists.osgeo.org<mailto:qgis-user-boun...@lists.osgeo.org>> 
De la part de PIERRE Sylvain via QGIS-User
Envoyé : lundi 13 mars 2023 08:56
À : LI, Xin Stephen [MIT] <stephe...@eduhk.hk<mailto:stephe...@eduhk.hk>>
Cc : qgis-user@lists.osgeo.org<mailto:qgis-user@lists.osgeo.org>
Objet : Re: [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://protect2.fireeye.com/v1/url?k=31323334-501cfaeb-3130cb80-454455535732-28bef29d5316aeb1&q=1&e=4861685e-e8b2-49a8-9282-17cb5134c3f5&u=https%3A%2F%2Fintranet.alsace.eu%2Factualites%2Fapprenez-a-reconnaitre-un-email-phishing%2F>
Hi,

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


De : QGIS-User 
<qgis-user-boun...@lists.osgeo.org<mailto:qgis-user-boun...@lists.osgeo.org>> 
De la part de LI, Xin Stephen [MIT] via QGIS-User
Envoyé : lundi 13 mars 2023 07:30
À : qgis-user@lists.osgeo.org<mailto:qgis-user@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://protect2.fireeye.com/v1/url?k=31323334-501cfaeb-3130cb80-454455535732-28bef29d5316aeb1&q=1&e=4861685e-e8b2-49a8-9282-17cb5134c3f5&u=https%3A%2F%2Fintranet.alsace.eu%2Factualites%2Fapprenez-a-reconnaitre-un-email-phishing%2F>
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.
_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to