可以从Mac M1 Monterey上的Psycopg2进口12.3.1
在安装psycopg2 -binary == 2.9.1通过pip install -r unignts.txt
,当我运行python manage.py runserver
command 命令在django项目中本地命令,我得到以下输出和错误:
main()
File "/Users/gabrielnaughton/development/tamato/manage.py", line 25, in main
execute_from_command_line(sys.argv)
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/core/management/base.py", line 343, in run_from_argv
connections.close_all()
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/db/utils.py", line 232, in close_all
for alias in self:
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/db/utils.py", line 226, in __iter__
return iter(self.databases)
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/db/utils.py", line 153, in databases
self._databases = settings.DATABASES
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/conf/__init__.py", line 82, in __getattr__
self._setup(name)
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/conf/__init__.py", line 69, in _setup
self._wrapped = Settings(settings_module)
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/conf/__init__.py", line 170, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/gabrielnaughton/development/tamato/settings/__init__.py", line 1, in <module>
from settings.common import *
File "/Users/gabrielnaughton/development/tamato/settings/common.py", line 16, in <module>
from common.util import is_truthy
File "/Users/gabrielnaughton/development/tamato/common/util.py", line 38, in <module>
from psycopg2.extras import DateRange
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/psycopg2/__init__.py", line 51, in <module>
from psycopg2._psycopg import ( # noqa
ImportError: dlopen(/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/psycopg2/_psycopg.cpython-39-darwin.so, 0x0002): tried: '/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/psycopg2/_psycopg.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
我已经看过这个问题对我不起作用。任何其他想法都非常感激。
After installing psycopg2-binary==2.9.1 via pip install -r requirements.txt
, when I run python manage.py runserver
command locally in a django project I get the following output and error:
main()
File "/Users/gabrielnaughton/development/tamato/manage.py", line 25, in main
execute_from_command_line(sys.argv)
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/core/management/base.py", line 343, in run_from_argv
connections.close_all()
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/db/utils.py", line 232, in close_all
for alias in self:
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/db/utils.py", line 226, in __iter__
return iter(self.databases)
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/db/utils.py", line 153, in databases
self._databases = settings.DATABASES
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/conf/__init__.py", line 82, in __getattr__
self._setup(name)
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/conf/__init__.py", line 69, in _setup
self._wrapped = Settings(settings_module)
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/django/conf/__init__.py", line 170, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/gabrielnaughton/development/tamato/settings/__init__.py", line 1, in <module>
from settings.common import *
File "/Users/gabrielnaughton/development/tamato/settings/common.py", line 16, in <module>
from common.util import is_truthy
File "/Users/gabrielnaughton/development/tamato/common/util.py", line 38, in <module>
from psycopg2.extras import DateRange
File "/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/psycopg2/__init__.py", line 51, in <module>
from psycopg2._psycopg import ( # noqa
ImportError: dlopen(/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/psycopg2/_psycopg.cpython-39-darwin.so, 0x0002): tried: '/Users/gabrielnaughton/development/tamato/venv/lib/python3.9/site-packages/psycopg2/_psycopg.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
I have already seen this question and the top rated answer doesn't work for me. Any other ideas gratefully received.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论