how to make vpython .exe using pyinstaller
<p>I have a simple script using vpython (just  testing) and I want to create a .exe file with pyinstaller.</p>

<p>This is the script:</p>

<pre><code>from visual import*
box()
</code></pre>

<p>Then I run in the console:</p>

<pre><code>pyinstaller sss.py
</code></pre>

<p>But the .exe dont work(obviously)</p>

<p>I've been googling about how to make the .spec file for vpython but dont find nothing.</p>

<p>Also tried making this .spec file</p>

<pre><code># -*- mode: python -*-

block_cipher = None


a = Analysis(['sss.py'],
             pathex=['C:\\Users\\hdfh\\Documents\\Python Scripts'],
             binaries=None,
             datas=None,
             hiddenimports=(['visual','vis','visual_common','viddle']),
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='sss.exe',
          debug=False,
          strip=None,
          upx=True,
          console=False )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=None,
               upx=True,
               name='sss')
</code></pre>

<p>But it dindt work</p>

<p>I will reponse myself, maybe it helps someone.</p>

<p>When pyinstaller is used with vpython and you try to run the .exe file, it has problem for find the TGA archives placed in </p>

<pre><code>C:\Anaconda2\Lib\site-packages\visual_common
</code></pre>

<p>So we have to edit the archive materials.py</p>

<pre><code>C:\Anaconda2\Lib\site-packages\visual_common\materials.py
</code></pre>

<p>Here we look for the code</p>

<pre><code>import sys
if hasattr(sys,'frozen') and (sys.frozen=="windows_exe" or sys.frozen=="console_exe"):
    texturePath="visual\\"
else:
    texturePath = os.path.split( __file__ )[0] + "/"
del sys
</code></pre>

<p>For me worked change <code>texturePath=...</code>to another directory, for example C:</p>

<pre><code>import sys
if hasattr(sys,'frozen') and (sys.frozen=="windows_exe" or sys.frozen=="console_exe"):
    texturePath=os.path.abspath("C:/")
else:
    texturePath = os.path.abspath("C:/")
del sys
</code></pre>

<p>Save it and MOVE the TGA archives from visual_common to C:/ (or to the chosen place) and finally try to build the .exe from the console</p>

<pre><code>pyinstaller test.py
</code></pre>

<p>For this works...</p>

python pyinstaller vpython