title: Pyinstaller, only packing part of the employed third-party packages, and calling the remaining on another PC
body: <ol>
  <li>On PC1, I have a program in which package A B C is employed, and I'd
  like to pack the program by Pyinstaller together with package A B
  (excluding C for some reason), obtaining &quot;main.exe&quot;.</li>
  <li>Assuming that there's another machine PC2 installed with python and
  package C, I hope to run this &quot;main.exe&quot; (without package C
  embedded) on PC2, during which package C installed on PC2 is called.</li>
  </ol>
  <p>Is this realizable? and How?</p>
  <p>I pack the program on PC1 by:<code>pyinstaller main.py --exclude-module C</code> and as expected, failing to execute main.exe on PC2 with <code>ModuleNotFoundError: No module named 'C'</code>, since package C installed on PC2 can not be recognized by main.exe.</p>
  <p>To be precise, Package C mentioned refers to &quot;geatpy&quot; <a href="http://geatpy.com/" rel="nofollow noreferrer">http://geatpy.com</a>, Package A, B refer to Numpy, Pandas, xlwt, etc. Bundling all of these into one bundle and running it, some errors occur:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;main.py&quot;, line 9, in &lt;module&gt;
      from optimization import *  
    File &quot;PyInstaller\loader\pyimod03_importers.py&quot;, line 540, in exec_module
    File &quot;optimization.py&quot;, line 20, in &lt;module&gt;
      import geatpy as ea  
    File &quot;PyInstaller\loader\pyimod03_importers.py&quot;, line 540, in exec_module
    File &quot;geatpy\__init__.py&quot;, line 16, in &lt;module&gt;
  ModuleNotFoundError: No module named 'awGA'
  [48140] Failed to execute script main
  </code></pre>
  <p>After enquiring with the developer of this module, he suggests excluding this module in the bundle, and install via pip cmd instead, because pyinstaller may be not well compatible with pyd/dll file. I am quite new to coding, so maybe I can't get his point or there may be some misunderstanding.</p>