title: Prevent a Python-embedded to look in my default path C:\Python38 for modules
body: <p>I'm using Cython in <code>--embed</code> mode to produce a .exe. I'm evaluating the <a href="https://stackoverflow.com/questions/62390978/minimal-set-of-files-required-to-distribute-an-embed-cython-compiled-code-and-ma/62392087#62392087">Minimal set of files required to distribute an embed-Cython-compiled code and make it work on any machine</a>. To do this, I only copy a minimal number of files from the Python Windows <a href="https://www.python.org/downloads/windows/" rel="nofollow noreferrer">embeddable package</a>.</p>
  <p>In order to check this, I need to be sure that the current process I'm testing <em>doesn't</em> in fact use my system default Python install, i.e. C:\Python38.</p>
  <p>To do this, I open a new <code>cmd.exe</code> and do <code>set PATH=</code> which temporarily removes everything from the PATH. Then I can test any self-compiled <code>app.exe</code> and make sure it doesn't reuse <code>C:\Python38</code>'s files under the hood.</p>
  <p>It works, except for the modules. Even after doing <code>set PATH=</code>, my code <code>app.py</code></p>
  <pre><code>import json
  print(json.dumps({&quot;a&quot;:&quot;b&quot;}))
  </code></pre>
  <p>when Cython-<code>--embed</code>-compiled into a .exe works, but it still uses <code>C:\Python38\Lib\json\__init__.py</code>! I know this for sure, because if I temporarily remove this file, my .exe now fails, because it cannot find the <code>json</code> module.</p>
  <p><strong>How to completely remove any link to <code>C:\Python38</code> when debugging a Python program which shouldn't use these files?</strong></p>
  <p>Why isn't <code>set PATH=</code> enough? Which other environment variable does it use for modules? I checked all my system variables and I think I don't find any which seems related to Python.</p>