<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:新細明體;
panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"Microsoft YaHei";
panose-1:2 11 5 3 2 2 4 2 2 4;}
@font-face
{font-family:"\@新細明體";
panose-1:2 1 6 1 0 1 1 1 1 1;}
@font-face
{font-family:"\@Microsoft YaHei";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle25
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi, Sylvain,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks for your suggestions.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is the qgis-bin.env file in the GQIS/bin dir? <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It includes <o:p></o:p></p>
<p class="MsoNormal">PATH=C:\OSGeo4W\apps\qgis\bin;<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>From:</b> PIERRE Sylvain <sylvain.pierre@alsace.eu> <br>
<b>Sent:</b> 2023<span lang="ZH-CN" style="font-family:"Microsoft YaHei",sans-serif">年</span>3<span lang="ZH-CN" style="font-family:"Microsoft YaHei",sans-serif">月</span>13<span lang="ZH-CN" style="font-family:"Microsoft YaHei",sans-serif">日</span> 4:03 PM<br>
<b>To:</b> PIERRE Sylvain <sylvain.pierre@alsace.eu>; LI, Xin Stephen [MIT] <stephenli@eduhk.hk><br>
<b>Cc:</b> qgis-user@lists.osgeo.org<br>
<b>Subject:</b> RE: How to set PyQGIS imported in VS Code in Windows for a Python file?<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="mso-element:para-border-div;border:solid windowtext 1.0pt;padding:4.0pt 4.0pt 4.0pt 4.0pt;background:yellow;margin-left:6.0pt;margin-right:6.0pt">
<p style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;background:yellow;border:none;padding:0cm">
<span lang="FR" style="font-size:9.0pt;font-family:"Microsoft YaHei",sans-serif;color:red">CAUTION:</span><span lang="FR" style="font-size:9.0pt;font-family:"Microsoft YaHei",sans-serif;color:black"> External email. Do not click links or open attachments unless
you recognise the sender and know the content is safe.<br>
</span><span lang="ZH-CN" style="font-size:9.0pt;font-family:"Microsoft YaHei",sans-serif;color:red">警告:</span><span lang="ZH-CN" style="font-size:9.0pt;font-family:"Microsoft YaHei",sans-serif;color:black">外來電郵。 如不認識寄件者,或不確定內容是否安全,切勿按下任何連結或開啟任何附件。</span><span lang="FR" style="font-size:9.0pt;font-family:"Microsoft YaHei",sans-serif;color:black"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="FR" style="color:#1F497D;mso-fareast-language:EN-US">Oops ! it’s in .env file and it looks like this for me :<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR" style="color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR" style="color:#1F497D;mso-fareast-language:EN-US">PATH=$PATH;"C:\Program Files\QGIS 3.16.16\bin\";"C:\Program Files\QGIS 3.16.16\apps\qgis\bin"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR" style="color:#1F497D;mso-fareast-language:EN-US">PYTHONPATH="C:\Program Files\QGIS 3.16.16\apps\qgis\python"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR" style="color:#1F497D;mso-fareast-language:EN-US">PYTHON_VERSION=Python39<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR" style="color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<table class="MsoNormalTable" border="0" cellspacing="3" cellpadding="0" width="645" style="width:483.45pt;margin-left:-1.5pt">
<tbody>
<tr style="height:115.45pt">
<td width="131" valign="top" style="width:98.5pt;padding:0cm 0cm 0cm 0cm;height:115.45pt">
<p class="MsoNormal" style="margin-left:21.3pt;text-indent:-21.3pt;line-height:115%">
<span style="color:#1F497D"><img width="103" height="143" style="width:1.0729in;height:1.4895in" id="Image_x0020_2" src="cid:image005.jpg@01D9567D.5045C230"></span><b><span style="font-size:14.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:#CC0066"><o:p></o:p></span></b></p>
</td>
<td width="507" style="width:380.45pt;padding:1.5pt 1.5pt 1.5pt 1.5pt;height:115.45pt">
<p class="MsoNormal" style="mso-margin-top-alt:1.0pt;margin-right:0cm;margin-bottom:1.0pt;margin-left:21.3pt;text-indent:-21.3pt;line-height:115%">
<span style="font-size:13.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:#003399">Sylvain PIERRE</span><b><span style="font-family:"Verdana",sans-serif;color:#003399"><o:p></o:p></span></b></p>
<p class="MsoNormal" style="mso-margin-top-alt:1.0pt;margin-right:0cm;margin-bottom:1.0pt;margin-left:0cm;line-height:115%">
<span style="font-size:8.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:black">Chef de projet système d’information<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:1.0pt;margin-right:0cm;margin-bottom:1.0pt;margin-left:0cm;line-height:115%">
<span style="font-size:8.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:black">Direction des Systèmes d’Information et du Développement Numérique<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:1.0pt;margin-right:0cm;margin-bottom:1.0pt;margin-left:0cm;line-height:115%">
<span style="font-size:8.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:black">Service Projets et Ingénierie Numérique<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:1.0pt;margin-right:0cm;margin-bottom:1.0pt;margin-left:0cm;line-height:115%">
<b><span style="font-size:8.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:black">Collectivité européenne d’Alsace<o:p></o:p></span></b></p>
<p class="MsoNormal" style="mso-margin-top-alt:1.0pt;margin-right:0cm;margin-bottom:1.0pt;margin-left:0cm;line-height:115%">
<span style="font-size:8.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:black">Tél : 03 88 76 68 88<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:1.0pt;margin-right:0cm;margin-bottom:1.0pt;margin-left:0cm;line-height:115%">
<span style="font-size:8.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:black"><a href="mailto:sylvain.pierre@alsace.eu"><span style="color:blue">sylvain.pierre@alsace.eu</span></a><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:1.0pt;margin-right:0cm;margin-bottom:1.0pt;margin-left:0cm;line-height:115%">
<span style="color:#1F497D;mso-fareast-language:EN-US"><a href="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"><span style="font-size:8.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:blue;mso-fareast-language:FR">www.alsace.eu</span></a></span><span style="font-size:8.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:1.0pt;margin-right:0cm;margin-bottom:1.0pt;margin-left:0cm;line-height:115%">
<a href="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"><span style="font-size:8.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:#1F497D;text-decoration:none"><img border="0" width="14" height="15" style="width:.1458in;height:.1562in" id="Image_x0020_4" src="cid:image007.png@01D9567D.5045C230" alt="facebook"></span></a><span style="font-size:8.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:#1F497D"> </span><a href="http://www.twitter.com/toutelalsace"><span style="font-size:8.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:#1F497D;text-decoration:none"><img border="0" width="15" height="15" style="width:.1562in;height:.1562in" id="Image_x0020_7" src="cid:image009.png@01D9567D.5045C230" alt="twitter"></span></a><span style="font-size:8.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:#1F497D"> </span><a href="http://www.instagram.com/toutelalsace"><span style="font-size:8.0pt;line-height:115%;font-family:"Verdana",sans-serif;color:#1F497D;text-decoration:none"><img border="0" width="15" height="15" style="width:.1562in;height:.1562in" id="Image_x0020_8" src="cid:image011.png@01D9567D.5045C230" alt="insta"></span></a><span style="color:#1F497D;mso-fareast-language:EN-US"><o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p class="MsoNormal"><span lang="FR" style="color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="FR">De :</span></b><span lang="FR"> QGIS-User <<a href="mailto:qgis-user-bounces@lists.osgeo.org">qgis-user-bounces@lists.osgeo.org</a>>
<b>De la part de</b> PIERRE Sylvain via QGIS-User<br>
<b>Envoyé :</b> lundi 13 mars 2023 08:56<br>
<b>À :</b> LI, Xin Stephen [MIT] <<a href="mailto:stephenli@eduhk.hk">stephenli@eduhk.hk</a>><br>
<b>Cc :</b> <a href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a><br>
<b>Objet :</b> Re: [Qgis-user] How to set PyQGIS imported in VS Code in Windows for a Python file?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="FR"><o:p> </o:p></span></p>
<table class="MsoNormalTable" border="0" cellspacing="3" cellpadding="0" width="100%" style="width:100.0%">
<tbody>
<tr>
<td width="100%" style="width:100.0%;background:#FFFF99;padding:4.8pt 4.8pt 4.8pt 4.8pt">
<p class="MsoNormal" align="center" style="text-align:center"><strong><span style="font-size:7.5pt;font-family:"Verdana",sans-serif;color:#002266">Soyez vigilant : ce courriel provient d'une organisation externe à la CeA.</span></strong><span style="font-size:7.5pt;font-family:"Verdana",sans-serif;color:#002266">
<br>
• Assurez-vous d’abord qu’il ne s’agit pas d’un email malveillant avant de cliquer sur tout lien ou pièce jointe.
<br>
<a href="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">Apprendre à reconnaître
un email de phishing.</a> </span><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="padding:4.8pt 4.8pt 4.8pt 4.8pt"></td>
</tr>
</tbody>
</table>
<div>
<p class="MsoNormal"><span lang="FR" style="color:#1F497D;mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR" style="color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR" style="color:#1F497D;mso-fareast-language:EN-US">Did you set these variable in env file in your user .vscode dir ?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR" style="color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR" style="color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="FR">De :</span></b><span lang="FR"> QGIS-User <<a href="mailto:qgis-user-bounces@lists.osgeo.org">qgis-user-bounces@lists.osgeo.org</a>>
<b>De la part de</b> LI, Xin Stephen [MIT] via QGIS-User<br>
<b>Envoyé :</b> lundi 13 mars 2023 07:30<br>
<b>À :</b> <a href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a><br>
<b>Objet :</b> [Qgis-user] How to set PyQGIS imported in VS Code in Windows for a Python file?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="FR"><o:p> </o:p></span></p>
<table class="MsoNormalTable" border="0" cellspacing="3" cellpadding="0" width="100%" style="width:100.0%">
<tbody>
<tr>
<td width="100%" style="width:100.0%;background:#FFFF99;padding:4.8pt 4.8pt 4.8pt 4.8pt">
<p class="MsoNormal" align="center" style="text-align:center"><strong><span style="font-size:7.5pt;font-family:"Verdana",sans-serif;color:#002266">Soyez vigilant : ce courriel provient d'une organisation externe à la CeA.</span></strong><span style="font-size:7.5pt;font-family:"Verdana",sans-serif;color:#002266">
<br>
• Assurez-vous d’abord qu’il ne s’agit pas d’un email malveillant avant de cliquer sur tout lien ou pièce jointe.
<br>
<a href="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">Apprendre à reconnaître
un email de phishing.</a> </span><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="padding:4.8pt 4.8pt 4.8pt 4.8pt"></td>
</tr>
</tbody>
</table>
<div>
<p class="MsoNormal">The OS is Windows 10,<o:p></o:p></p>
<p class="MsoNormal">The QGIS version is 3.28 LTR<o:p></o:p></p>
<p class="MsoNormal">The Python version is 3.11<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The steps following the steps in stection 1.4.1 for the PyQGIS Cookbook (GQIS Testing), i.e.
<a href="https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html#python-applications">
https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html#python-applications</a>
<o:p></o:p></p>
<p class="MsoNormal">The “PAHT” and “PYTHONPYTHON” have been added. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The problem is: <o:p></o:p></p>
<p class="MsoNormal">When running the Python program file with “import qgis.core”, there is the error
<o:p></o:p></p>
<p class="MsoNormal"><span lang="ZH-CN" style="font-family:"新細明體",serif">“</span>ModuleNotFoundError: No module named 'qgis' ”<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Any suggestions could help modify this setting?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks.<o:p></o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>