【发布时间】:2012-09-25 12:47:08
【问题描述】:
我正在尝试为我的 django 项目设置一个 PostgreSQL 数据库,我相信我现在已经完成了,这要感谢我对上一个问题 Problems setting up a postgreSQL database for a django project 的回复。我现在正在尝试在终端中运行命令“python manage.py runserver”来启动我的本地主机,但是当我运行该命令时,我看到了这个响应......
Error: No module named psycopg2.extensions
我不确定这意味着什么 - 我尝试下载 psycopg2,但似乎找不到使用自制软件下载 psycopg2 的方法。我尝试过 easy_install、pip install 和 sudo,但都返回这样的错误...
Downloading http://www.psycopg.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.5.tar.gz
Processing psycopg2-2.4.5.tar.gz
Writing /tmp/easy_install-l7Qi62/psycopg2-2.4.5/setup.cfg
Running psycopg2-2.4.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-l7Qi62/psycopg2-2.4.5/egg-dist-tmp-PBP5Ds
no previously-included directories found matching 'doc/src/_build'
unable to execute gcc-4.0: No such file or directory
error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1
如何解决这个问题?
【问题讨论】:
-
您没有安装编译器,您需要一个编译器来构建 psycopg2 包。如果您可以提供有关您的操作系统的详细信息,这里的人可能会为您提供帮助。
-
@IanClelland 谢谢伊恩。我在 Mac OS X 10.6.8 上。如果有帮助,我已经安装了自制软件。
-
从正确的 venv 检查您正在使用的解释器。
标签: python django postgresql psycopg2