Friday, 25 August 2023

Error when running py2app init_import_site: Failed to import the site module

I am currently dabbling in Python. I have now created a mini project for testing. For this I have installed PySide6 and built a none window:

`from PySide6.QtWidgets import QApplication, QMainWindow
from widgets.main import Ui_frmMain

class FrmMain(QMainWindow, Ui_frmMain):
def __init__(self):
super().__init__()
self.setupUi(self)

app = QApplication()
frm_main = FrmMain()
frm_main.show()
app.exec()`

Now I wanted to create a macOS app with py2app

`python3 setup.py py2app -A`

After running it I wanted to test the file and get the following error message

`Fatal Python error: init_import_site: 
Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "/Users/xxx/Python3/python-projekte/beginner/dist/main.app/Contents/Resources/site.py",     line 182, in <module>
import sitecustomize  # noqa: F401
File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/sitecustomize.py", line 38, in <module>
site.PREFIXES[:] = [new_prefix if x == sys.prefix else x for x in site.PREFIXES]
AttributeError: partially initialized module 'site' has no attribute 'PREFIXES' (most likely due to a circular import)`

Do you have any idea?

When searching for the cause in the forum I had leide rkeine success



from Error when running py2app init_import_site: Failed to import the site module

No comments:

Post a Comment