73 lines
2.7 KiB
Python
73 lines
2.7 KiB
Python
"""
|
||
Скрипт для создания 32-битной версии программы
|
||
ВАЖНО: Этот скрипт нужно запускать на 32-битном Python!
|
||
"""
|
||
import PyInstaller.__main__
|
||
import sys
|
||
import platform
|
||
|
||
def check_architecture():
|
||
"""Проверяет архитектуру Python"""
|
||
arch = platform.architecture()[0]
|
||
machine = platform.machine()
|
||
|
||
print(f"🔍 Текущая архитектура Python: {arch}")
|
||
print(f"🖥️ Тип машины: {machine}")
|
||
|
||
if arch == '32bit':
|
||
print("✅ Python 32-bit - подходит для создания 32-битной программы")
|
||
return True
|
||
else:
|
||
print("❌ Python 64-bit - НЕ подходит для создания 32-битной программы")
|
||
print("💡 Для создания 32-битной версии нужен 32-битный Python")
|
||
return False
|
||
|
||
def build_32bit_executable():
|
||
"""Создает 32-битный исполняемый файл"""
|
||
|
||
if not check_architecture():
|
||
print("\n⚠️ ВНИМАНИЕ: Для создания 32-битной программы:")
|
||
print("1. Скачайте 32-битный Python с https://www.python.org/downloads/")
|
||
print("2. Установите зависимости: pip install pyinstaller pandas openpyxl lxml")
|
||
print("3. Запустите этот скрипт снова")
|
||
return False
|
||
|
||
# Параметры для PyInstaller (32-бит)
|
||
args = [
|
||
'main.py',
|
||
'--onefile',
|
||
'--windowed',
|
||
'--name=KadastrParser_32bit',
|
||
'--icon=NONE',
|
||
'--add-data=services;services',
|
||
'--add-data=models;models',
|
||
'--hidden-import=tkinter',
|
||
'--hidden-import=pandas',
|
||
'--hidden-import=openpyxl',
|
||
'--hidden-import=lxml',
|
||
'--clean',
|
||
'--noconfirm',
|
||
'--target-architecture=x86', # Явно указываем 32-бит
|
||
]
|
||
|
||
print("\n🚀 Начинаем создание 32-битного исполняемого файла...")
|
||
print("📋 Параметры сборки:")
|
||
for arg in args:
|
||
print(f" {arg}")
|
||
print()
|
||
|
||
try:
|
||
# Запускаем PyInstaller
|
||
PyInstaller.__main__.run(args)
|
||
print("✅ 32-битная сборка завершена!")
|
||
print("📁 Исполняемый файл: dist/KadastrParser_32bit.exe")
|
||
return True
|
||
except Exception as e:
|
||
print(f"❌ Ошибка при сборке: {e}")
|
||
return False
|
||
|
||
if __name__ == "__main__":
|
||
print("🔧 Создание 32-битной версии программы")
|
||
print("=" * 50)
|
||
build_32bit_executable()
|