The problem is that im trying to use pyinstall, so i ran pip install pyinstaller as a first option but when i import the library says the next error:
Import "pyinstaller" could not be resolvedPylancereportMissingImports
So i uninstalled pyinstaller and ran the next line in Admin cmd:
py -3.12 -m pip install pyinstaller
but i dont have solution yet.
I will show you my pip list
altgraph 0.17.4attrs 23.1.0auto-py-to-exe 2.42.0bottle 0.12.25bottle-websocket 0.2.9certifi 2023.11.17cffi 1.16.0charset-normalizer 3.3.2chromedriver-binary 122.0.6193.0.0Eel 0.16.0et-xmlfile 1.1.0future 0.18.3gevent 23.9.1gevent-websocket 0.10.1greenlet 3.0.3h11 0.14.0idna 3.6joblib 1.3.2markdown-it-py 3.0.0mdurl 0.1.2msedge-selenium-tools 3.141.4numpy 1.26.3openpyxl 3.1.2outcome 1.3.0.post0packaging 23.2pandas 2.2.0pefile 2023.2.7pip 24.0pycparser 2.21Pygments 2.17.2pyinstaller 6.4.0pyinstaller-hooks-contrib 2024.1pyparsing 3.1.1PySocks 1.7.1python-dateutil 2.8.2pytz 2024.1pywin32-ctypes 0.2.2requests 2.31.0rich 13.7.0schedule 1.2.1scikit-learn 1.4.0scipy 1.12.0selenium 4.16.0setuptools 69.0.3six 1.16.0sniffio 1.3.0sortedcontainers 2.4.0termcolor 2.4.0threadpoolctl 3.2.0trio 0.23.2trio-websocket 0.11.1tzdata 2023.4unzip 1.0.0urllib3 2.1.0whichcraft 0.6.1wsproto 1.2.0zope.event 5.0zope.interface 6.1And the code when i trying to import:
import osimport pyinstaller# Nombre de tu scriptscript_name = "tu_script.py"# Compilar el script a un ejecutablepyinstaller.run(["--onefile","--noconsole", script_name])# Ruta del archivo ejecutableexe_path = os.path.join("dist", f"{script_name}.exe")# Crear acceso directo en el escritoriodesktop_path = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')shortcut_path = os.path.join(desktop_path, f"{script_name}.lnk")with open(shortcut_path, "w") as f: f.write(f"""[Desktop Entry]Type=ApplicationName={script_name}Exec={exe_path}Icon={exe_path}Comment={script_name}Categories=Application;""")print("¡.exe and direct acces created!")