Getting error when using pynput with pyinstaller
Please fall back to 1.6.8 version of pynput. pip install pynput==1.6.8
Please fall back to 1.6.8 version of pynput. pip install pynput==1.6.8
If you are using virtualenv you should use the “-p” or “–path=”D:…”” option. Like this: pyinstaller.exe –onefile –paths=D:\env\Lib\site-packages .\foo.py What this does is generates foo.spec file with this pathex path
same problem here: OS: Win10 Python: 3.7 pyinstaller installed by pip install pyinstaller fix by (same solution with above, by no need download): pip uninstall pyinstaller pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
I’m suprised that no one mentioned the official supported option using Tree(): https://stackoverflow.com/a/20677118/2230844 https://pyinstaller.readthedocs.io/en/stable/advanced-topics.html#the-toc-and-tree-classes
When packaged to a single file with PyInstaller, running the .exe will unpack everything to a folder in your TEMP directory, run the script, then discard the temporary files. The path of the temporary folder changes with each running, but a reference to its location is added to sys as sys._MEIPASS. To make use of … Read more
After scratching my head all weekend and looking further on SO, I managed to compile the standalone .exe as expected using the UI files. Firstly, I defined the following function using this answer Bundling data files with PyInstaller (–onefile) # Define function to import external files when using PyInstaller. def resource_path(relative_path): “”” Get absolute path … Read more
Sorry, I thought that only -F/–one-file makes such behavior, but looks like any bundling with pyinstaller needs such changes. You need to change your code like this, as explained in this answer: import sys if getattr(sys, ‘frozen’, False): image = PhotoImage(file=os.path.join(sys._MEIPASS, “files/bg.png”)) else: image = PhotoImage(file=”files/bg.png”) And then bundle it with pyinstaller like this: pyinstaller … Read more
Based on the links provided by KeyWeeUsr (Bundling data files with PyInstaller and Using PyInstaller to make EXEs from Python scripts) and combining that with Kivy’s resource path method, here’s a workable solution. I feel it’s a bit rough around the edges because it uses SYS._MEIPASS (I would prefer a public API) and requires adding … Read more
Just to summarise the options here as I use them. PyInstaller TOC’s – are, as the documentation says: A TOC appears to be a list of tuples of the form (name, path, typecode). In fact, it’s an ordered set, not a list. A TOC contains no duplicates, where uniqueness is based on name only. In … Read more
I ran into the same issue. I boiled it down to a simple script like this Hello.py: import pandas print “hello world, pandas was imported successfully!” To get pandas to import at run-time correctly I had to modify the Hello.spec to the following: # -*- mode: python -*- block_cipher = None def get_pandas_path(): import pandas … Read more