Mac M1芯片python架构错误(x86_64'
我在M1 Mac上运行Django遇到了困难。每当我尝试运行服务器或进行迁移时,我都会得到(Mach-O文件,但是一个不兼容的架构(具有'x86_64',需要'arm64e')
错误。
我的终端正在打开Rosetta和我正在使用VSCODE IDE。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您正在运行Django版本,该版本可能与上一代MAC一起使用,但是M1和M2具有不同的硬件,这就是为什么您使用的版本不起作用的原因。
您是如何在M1上安装Django的?您有您遵循的指南吗?
这是一个链接< /a>我发现这很简单。
如果您按照说明有任何麻烦,请随时提出!
You are running a version of django that might work with previous generation macs, but the M1 and M2 have different hardware which is why the version you're using is not working.
How did you install django on your M1? Do you have a guide that you followed?
Here is one link I found that was pretty straightforward.
If you have any trouble following the instructions, feel free to ask!
您的问题有点缺乏细节。我可以告诉你几件事。首先,这可能不是Django的问题,而是图书馆的问题。 Django用Pure Python编写,因此应该是Architecture Anostic,这意味着没有理由将其带来这样的错误。确保您可以使用'Python -version'从命令行中运行Python。它应该简单地为您提供您已安装的Python版本。如果您遇到相同的错误,则安装了错误的Python版本。如果您没有错误,则可能已经安装了一些包含X86体系结构的代码的软件包。您将必须弄清楚哪个软件包,然后将其删除,然后尝试为您的体系结构安装正确的软件包。
由于您不说自己是如何运行Django的,因此它也可能是Python或其库之外的东西。例如,如果您试图运行某种服务器体系结构,而不是运行开发环境,则该软件也可能是架构的错误版本。
但是,如果您想要更好的答案,则需要提供更多信息。
Your question is a bit lacking on details. I can tell you a couple things though. First, this is probably not a problem with django, but more a problem with libraries. Django is written in pure python, so it should be architecture agnostic, which means there should be no reason that it throws such an error. Make sure that you can run python from the command line with 'python --version'. It should simply give you the python version you have installed. If you instead get the same error, you have the wrong version of python installed. If you get no errors, you probably have installed some package that includes code compiled for an x86 architecture. You will have to figure out which package that is, remove it, and try installing the correct package for your architecture.
Since you don't say how you are running django, it could be something outside of python or its libraries as well. For instance, if you are attempting to run some sort of server architecture, and not running the development environment, that software could be the wrong version for the architecture as well.
If you want better answers though, you need to provide more information.
因此,我运行
pipenv install psycopg2
,然后尝试python3 manage.py runserver
,它在没有错误的情况下进行了编译。So I ran
pipenv install psycopg2
and then triedpython3 manage.py runserver
again and It compiled without the error.