صفحه 1 از 1

پایتون در مک های سری M

ارسال شده: 16 آپریل 2023, 17:23
توسط iSam
سلام به همگی.
من هر روز روی مک استوديو خودم با پایتون برنامه نویسی میکنم و کلا تا چند روز پیش مشکلی نبود ولی از چند روز پیش وقتی میخوام فایلهای پایتونی (فقط آنها که درونشان import هست) را اجرا کنم ارور not module found و اینجور ارورها را میگیرم که با کمی کنکاش و تغییرات در init.py رسیدم به این ارور که حکایت از عدم تطابق با مک من دارد و اگر من نتونم روی مکم کد بنویسم، مک برایم کلا ارزشی نخواهد داشت‫.
کسی راهکاری یا تجربه ای در این زمینه داره؟
ممنون.

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so' (no such file), '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

پاسخ: پایتون در مک های سری M

ارسال شده: 16 آپریل 2023, 17:42
توسط Ilia
سامان این مشابه مشکل شماست؟
https://stackoverflow.com/questions/717 ... installing

فکر نکنم مشکل غیر قابل حلی باشه. اگر در stackoverflow بپرسی حتما جواب میگیری.

پاسخ: پایتون در مک های سری M

ارسال شده: 16 آپریل 2023, 20:10
توسط AmirT
سلام دوستان،
کل ارور رو بدون هیچ توضیحی توی ChatGPT کپی کردم و جوابی که داد این بود:
This error message indicates that there is a compatibility issue with the architecture of the file md.cpython-311-darwin.so that is being loaded by the charset_normalizer package in Python 3.11 on a machine with an arm64 architecture.

The error message suggests that the file was compiled for x86_64 architecture, which is not compatible with arm64 architecture. This could happen if the package was installed on a different machine with x86_64 architecture and then transferred to a machine with arm64 architecture.

To fix this issue, you need to install a version of the charset_normalizer package that is compatible with arm64 architecture. You can try uninstalling the current version of the package and installing the latest version from the PyPI repository using pip.

To uninstall the package, run the following command in your terminal:

کد: انتخاب همه

pip uninstall charset_normalizer
To install the latest version of the package, run the following command in your terminal:

کد: انتخاب همه

pip install --upgrade charset_normalizer
This should install a compatible version of the charset_normalizer package and resolve the compatibility issue.
امیدوارم بدرد بخوره.

پاسخ: پایتون در مک های سری M

ارسال شده: 16 آپریل 2023, 20:17
توسط Ali.Rastegar
سامان جان همونطور که Chat GPT گفته (:))) مشکل از تفاوت معماری اون پکیج با خود پایتونته به نظر.

ولی فکر می‌کنم برعکسه، یعنی arm64 نصب شده ولی پایتونت داره x86_64 اجرا میشه.

برای اطمینان اینو لطفا توی ترمینال بزن:

کد: انتخاب همه

file /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so

پاسخ: پایتون در مک های سری M

ارسال شده: 16 آپریل 2023, 23:44
توسط iSam
Ilia نوشته شده:سامان این مشابه مشکل شماست؟
https://stackoverflow.com/questions/717 ... installing

فکر نکنم مشکل غیر قابل حلی باشه. اگر در stackoverflow بپرسی حتما جواب میگیری.
ایلیا جان بخشی از این مشکل مشابه من هست و اتفاقا این پست را دیده بودم و با کلی گشتن تو stackoverflow تا اینجای کار رسیدم.
بازم بگردم ببینم چه شود، ممنون.

پاسخ: پایتون در مک های سری M

ارسال شده: 16 آپریل 2023, 23:49
توسط iSam
Ali.Rastegar نوشته شده:سامان جان همونطور که Chat GPT گفته (:))) مشکل از تفاوت معماری اون پکیج با خود پایتونته به نظر.

ولی فکر می‌کنم برعکسه، یعنی arm64 نصب شده ولی پایتونت داره x86_64 اجرا میشه.

برای اطمینان اینو لطفا توی ترمینال بزن:

کد: انتخاب همه

file /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so
درست میگی علی جان، ولی من دارم روی arm64 کار میکنم.
اینم نتيجه این دستور:

/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so: Mach-O 64-bit bundle arm64

پاسخ: پایتون در مک های سری M

ارسال شده: 16 آپریل 2023, 23:50
توسط iSam
AmirT نوشته شده:سلام دوستان،
کل ارور رو بدون هیچ توضیحی توی ChatGPT کپی کردم و جوابی که داد این بود:
This error message indicates that there is a compatibility issue with the architecture of the file md.cpython-311-darwin.so that is being loaded by the charset_normalizer package in Python 3.11 on a machine with an arm64 architecture.

The error message suggests that the file was compiled for x86_64 architecture, which is not compatible with arm64 architecture. This could happen if the package was installed on a different machine with x86_64 architecture and then transferred to a machine with arm64 architecture.

To fix this issue, you need to install a version of the charset_normalizer package that is compatible with arm64 architecture. You can try uninstalling the current version of the package and installing the latest version from the PyPI repository using pip.

To uninstall the package, run the following command in your terminal:

کد: انتخاب همه

pip uninstall charset_normalizer
To install the latest version of the package, run the following command in your terminal:

کد: انتخاب همه

pip install --upgrade charset_normalizer
This should install a compatible version of the charset_normalizer package and resolve the compatibility issue.
امیدوارم بدرد بخوره.
ممنون امیر جان، ولی نتیجه ای نداد!

پاسخ: پایتون در مک های سری M

ارسال شده: 16 آپریل 2023, 23:53
توسط iSam
رفقای گل، مشکل را حل کردم.
موقع دیباگ برنامه دیدم داره با کامپایلر غلطی برنامه را اجرا میکنه که با تغییرش به پایینی مشکل حل شد.
چون من روی پایتون ۳.۹ همیشه کار میکنم ولی با آپدیت اتومات رفته بود روی ۳.۱۱.
راستی چه کنم که کلا بتونم روی ۳.۱۱ کار کنم؟