2

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 pipreqs and no solved

I also tried using pigar, in pycharm works but when is exe doesn'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?

  • @udoyhasan I want create a ```txt``` file and posteriorly install, but i can't solve problem with creating –  Jul 08 '21 at 15:51

1 Answers1

0

I make requirements.txt with pipreqs and upload to my GitHub, always that i need to download this libs i use pip install --no-cache-dir -r https://raw.githubusercontent.com/UserName/some_folder/requirements.txt to install all packages