I'm learning how to use requirements.txt and i don't know how solve this problem:
When i run my code in Pycharm, nothing wrong happen, just creates a txt with some packages, without errors. But, when i create a exe using cx_Freeze and run it, the requirements.txt is created but is empty.
# -*- encoding: utf-8 -*-
# Some useless imports to put in requirements.txt
import sys
import subprocess
import os
import pygetwindow
import PySimpleGUI
import pyautogui
import importlib.util
import psutil
import PySimpleGUI as pys
from time import sleep
# Command that i use
os.system(r'cmd /c pipreqs')
# Just a final window to verify if run correctly
layout = [
[pys.Text(f'Complete =)', size=(25, 0))],
]
jan = pys.Window('Test', layout=layout, finalize=True)
jan.read()
When i use os.system('cmd /c pip freeze > requirements.txt') and run, the requirements.txt is not created (running with exe)
i try
pip install pipreqsand no solved
I also tried using
pigar, in pycharm works but when isexedoesn't create a txt file
Basically, my code only works in PyCharm, and no matters what i try, don't works if is exe
What i can do?