環境作成
現在のフォルダにインストールされることに注意。
python -m venv myenvname
環境起動
作成されたフォルダにあるactivate.batを使う。
pip install pyinstaller pyinstaller yourprogram.py
python –version
pip install imgui[glfw]
########################################
This is what I’ve added to the .spec file
a.datas += [(‘images/icon.ico’, ‘D:\[workspace]\App\src\images\icon.ico’, ‘DATA’),
(‘images/loaderani.gif’,‘D:\[workspace]\App\src\images\loaderani.gif’,‘DATA’)]
I should add that I have tried not putting them in subfolders as well, didn’t make a difference.
139
Newer versions of PyInstaller do not set the env variable anymore, so Shish’s excellent answer will not work. Now the path gets set as sys._MEIPASS:
def resource_path(relative_path): "”” Get absolute path to resource, works for dev and for PyInstaller "”” try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
########################################
Create a directory structure like this:
- main.py # Your code goes here - don’t bother actually naming you file this
- hooks
- hook-tensorflow.py Copy the following into hook-tensorflow.py:
from PyInstaller.utils.hooks import collect_all
def hook(hook_api): packages = [ ‘tensorflow’, ‘tensorflow_core’, ‘astor’ ] for package in packages: datas, binaries, hiddenimports = collect_all(package) hook_api.add_datas(datas) hook_api.add_binaries(binaries) hook_api.add_imports(*hiddenimports) Then, when compiling, add the command line option –additional-hooks-dir=hooks.
If you come across more not fou
######################################## Tensorboard
12
GIT: how to merge two branches without actually merging files (trivial merge)
Use git merge -s ours B to perform a merge discarding any changes B would introduce. Still, the commits from B are now in A, however, the files are at the state of A before the merge.