Building an executable for python code using py2exe

I installed "py2exe" for "Python2.7", made the program "Hello World", used py2exe to build my exe, and it worked fine.

Now, when I tried to create an exe of my actual code, the folders are created and the exe is also created without any problems, but when I run exe, the console appears for less than a second and closes.

The only difference in this case and the test program is that in this case I have several code files, and in some of them I import several files / libraries The following are the import commands for different files:

from bs4 import BeautifulSoup
import time
import requests
from RdWrtCls import *
import os
import openpyxl 

Originally my source code:

from distutils.core import setup
import py2exe
from glob import glob
setup (console =['Crawler.py'])

, , dll, :

from distutils.core import setup
import py2exe
from glob import glob
data_files = [("Microsoft.VC100.CRT", glob(r'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\redist\\x86\\Microsoft.VC100.CRT\\*.*'))]

setup(data_files =data_files,console =['Crawler.py'])

, .

: : Windows 7, Python 2.7-32

:   , EXE.

Import error : No module named bs4
+4
2

exe. , , , , .

1) , .

2) (, ) .

3)

4) ​​BeautifulSoup4 pip

pip uninstall BeautifulSoup4
pip install  BeautifulSoup4

5) "jdcal" ( openpyxl)

6) openpyxl pip

7) jdcal pip

8) openpyxl pip ( jdcal)

9) exe .

+3

jdcal. B-Abbasi:

6) openpyxl pip
( Win7: pythonXX\Scripts\pip openpyxl)

7) jdcal pip

8) openpyxl pip ( jdcal)

9) exe .

+1

Source: https://habr.com/ru/post/1569883/


All Articles