I have installed pyinstaller in my Linux in order to create an executable to my Python script, which runs normaly with the command:
python3 exemplo.py
However when I execute bellow command:
pyinstaller --onefile example.py
I get the following error:
File "/home/pedro/.local/bin/pyinstaller", line 11, in <module> sys.exit(run()) File "/home/pedro/.local/lib/python2.7/site-packages/PyInstaller/__main__.py", line 79, in run import PyInstaller.building.build_main File "/home/pedro/.local/lib/python2.7/site-packages/PyInstaller/building/build_main.py", line 33, in <module> from ..depend import bindepend File "/home/pedro/.local/lib/python2.7/site-packages/PyInstaller/depend/bindepend.py", line 26, in <module> from . import dylib, utils File "/home/pedro/.local/lib/python2.7/site-packages/PyInstaller/depend/utils.py", line 25, in <module> from ..lib.modulegraph import util, modulegraph File "/home/pedro/.local/lib/python2.7/site-packages/PyInstaller/lib/modulegraph/util.py", line 16, in <module> from ._compat import StringIO, BytesIO, get_instructions, _READ_MODE File "/home/pedro/.local/lib/python2.7/site-packages/PyInstaller/lib/modulegraph/_compat.py", line 29, in <module> from dis3 import get_instructions ImportError: No module named dis3
What is wrong?
I tried to install dis3:
python3 -m pip install --user dis3
But I still get the same error.
I uninstalled it …
python -m pip uninstall pyinstaller
Installed again as recommended.
python3 -m pip install --user pyinstaller
I have set the PATH variable:
echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/pedro/.local/bin
Now I get the message:
pedro@pedro-pc:~/Documents/instabot/instabot_c.py$ python -m pyinstaller --onefile example.py /usr/bin/python: No module named pyinstaller
Indeed … it does not appear on pip list:
pedro@pedro-pc:~/Documents/instabot/instabot_c.py/__pycache__$ pip list /home/pedro/.local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown. warnings.warn(warning, RequestsDependencyWarning) Package Version -------------- ---------------------- altgraph 0.16.1 arandr 0.1.9 beautifulsoup4 4.4.1 certifi 2018.10.15 chardet 3.0.4 cryptography 1.2.3 defer 1.0.6 enum34 1.1.2 fake-useragent 0.1.11 future 0.17.1 html5lib 0.999 idna 2.7 ipaddress 1.0.16 lxml 3.5.0 macholib 1.11 numpy 1.11.0 pefile 2018.8.8 pip 18.1 psutil 3.4.2 pyasn1 0.1.9 pycurl 7.43.0 Pygments 2.1 pygobject 3.20.0 pyOpenSSL 0.15.1 pysqlite 2.7.0 python-apt 1.1.0b1+ubuntu0.16.4.2 python-debian 0.1.27 pyxdg 0.25 requests 2.20.0 scour 0.32 setuptools 20.7.0 six 1.10.0 urllib3 1.24 wheel 0.29.0
What is wrong?
Advertisement
Answer
I followed the instructions of this link:Python Issue It solved the last issue I mentioned.