我有一台运行 Apple M1 芯片的新款 (2021) Macbook Air。我已经设置了我的 django 应用程序,它使用 postgresql,并且创建了一个运行 Python 3.9.2 的 virtualenv。直接从 python.org 上的 macOS 64 位 universal2 安装程序安装了 Python。经过很多困难,我终于能够使用以下命令安装 psycopg2:
env LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/readline/lib" pip3 --no-cache install psycopg2-binary==2.8.6
Run Code Online (Sandbox Code Playgroud)
我能够通过 SSH 连接到我的 PostgreSQL 数据库,但是当我运行 python manage.py runserver 时,出现以下错误(由于长度而有所删节)。
File "/Users/seb/.virtualenvs/onefabric/lib/python3.9/site-packages/django/contrib
/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/Users/seb/.virtualenvs/onefabric/lib/python3.9/site-packages/django/contrib
/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/Users/seb/.virtualenvs/onefabric/lib/python3.9/site-packages/django/db/mode
ls/base.py", line 121, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/Users/seb/.virtualenvs/onefabric/lib/python3.9/site-packages/django/db/mode
ls/base.py", line 325, in add_to_class
value.contribute_to_class(cls, name)
File …Run Code Online (Sandbox Code Playgroud)