2

I'm trying to get Django running on OS X Mavericks and I've encountered a bunch of errors along the way, the latest way being that when runpython manage.py runserver to see if everything works, I get this error, which I believe means that it misses libssl:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: @loader_path/../lib/libssl.1.0.0.dylib Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so Reason: image not found

I have already upgraded Python to 2.7.6 with the patch that handles some of the quirks of Mavericks.

Any ideas?

Full traceback:

Unhandled exception in thread started by > Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 93, in inner_run self.validate(display_num_errors=True) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 280, in validate num_errors = get_validation_errors(s, app) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/validation.py", line 28, in get_validation_errors from django.db import models, connection File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/init.py", line 40, in backend = load_backend(connection.settings_dict['ENGINE']) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/init.py", line 34, in getattr return getattr(connections[DEFAULT_DB_ALIAS], item) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/utils.py", line 93, in getitem backend = load_backend(db['ENGINE']) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/utils.py", line 27, in load_backend return import_module('.base', backend_name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module import(name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 14, in from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/creation.py", line 1, in import psycopg2.extensions File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/init.py", line 50, in from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: @loader_path/../lib/libssl.1.0.0.dylib Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so Reason: image not found

4

5 回答 5

11

这对我有用。

brew unlink openssl && brew link openssl --force

这将正确地重新创建已安装的 libssl 1.0 的所有链接。

于 2014-12-17T16:09:19.617 回答
3

psycopg2 丢失。用于 Python 的 Postgresql 数据库适配器。

您需要重新安装 Postgresql。你在 Mac 上,所以使用brew.

brew install postgresql

如果 brew 输出它已经安装,请将其卸载并重新安装。

于 2013-11-04T12:23:34.383 回答
2

似乎libssl.1.0.0.dylib缺少了它。小牛随行libssl 0.9.8。您需要通过自制软件安装 libssl。

如果 loaderpath 指向/usr/lib/,您还需要将 libssl 从符号链接/usr/local/Cell/openssl/lib//usr/lib.

于 2013-11-04T16:56:35.787 回答
1

这个问题发生在我身上,因为我使用的是posqgressapp。这可能与沙盒有关。

删除 posqgressapp 并使用 brew 安装 postgress 解决了我的问题。

使用 HomeBrew 安装 Postgress:
http ://www.moncefbelyamani.com/how-to-install-postgresql-on-a-mac-with-homebrew-and-lunchy/

无法在 Mavericks 上打开 psql:
https ://github.com/PostgresApp/PostgresApp/issues/137

于 2013-11-05T14:36:32.983 回答
1

在我的 OSX 笔记本电脑上安装完整的 PostgreSQL 服务器让我很困扰。卸载很笨重,现在你有一个非常摇摆不定的数据库服务器,只是为了库而未使用。

我知道其他人反对使用 Postgres.app,但我喜欢它。它干净且易于使用。关键是要记住,它只是一个包含所有必要库的文件夹,以帮助在 OSX 机器上构建 Psycopg2。只需确保在路径中添加一些内容,以便您可以找到以下库:

$ PATH=$PATH:/Applications/Postgres93.app/Contents/MacOS/bin/

(更改,当然基于您安装的 Postgres.app 版本。)

一旦你编译好你的 psycopg2,你只需将 Postgres.app 拖到垃圾箱中,它就消失了。十分简单。

我在 OSX 和 Linux 上的各种错误和 psycopg2 上浪费了很多时间,所以我把它放在一起:

http://www.codychamberlain.com/posts/installing-psycopg2-on-osx/

于 2013-12-07T23:38:11.213 回答