错误:没有名为psycopg2.extensions的模块 [英] Error: No module named psycopg2.extensions

查看:316
本文介绍了错误:没有名为psycopg2.extensions的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的django项目设立一个PostgreSQL数据库,我相信我现在已经完成了对最后一个问题的回复为django项目设置postgreSQL数据库时出现的问题。我现在试图在终端中运行命令'python manage.py runserver'以获取我的本地主机,但是当我运行命令时,我看到这个响应...

 错误:没有名为psycopg2.extensions的模块

不知道这是什么意思 - 我已经尝试下载psycopg2,但似乎找不到一种方法来下载psycopg2使用自制软件。我已经尝试过easy_install,pip安装和sudo,但都返回这样的错误...

 下载http://www.psycopg .org / psycopg / tarballs / PSYCOPG-2-4 / psycopg2-2.4.5.tar.gz 
处理psycopg2-2.4.5.tar.gz
写/ tmp / easy_install-l7Qi62 / psycopg2- 2.4.5 / setup.cfg
运行psycopg2-2.4.5 / setup.py -q bdist_egg --dist-dir /tmp/easy_install-l7Qi62/psycopg2-2.4.5/egg-dist-tmp-PBP5Ds
没有以前包含的目录找到匹配'doc / src / _build'
无法执行gcc-4.0:没有这样的文件或目录
错误:安装脚本退出与错误:command'gcc-4.0 '失败,退出状态1

任何有关如何解决这个问题的帮助将非常感谢! p>

谢谢



Jess



(抱歉,如果这是一个非常简单的问题解决 - 这是我第一个django项目)

解决方案

首先要做的是安装依赖项。

  sudo apt-get build-dep python-psycopg2 

之后进入你的virtualenv并使用

  pip install psycopg2 

这两个命令应该可以解决问题。


I am trying to set up a PostgreSQL database for my django project, which I believe I have done now thanks to the replies to my last question Problems setting up a postgreSQL database for a django project. I am now trying to run the command 'python manage.py runserver' in Terminal to get my localhost up but when I run the command, I see this response...

Error: No module named psycopg2.extensions

I'm not sure what this means - I have tried to download psycopg2 but can't seem to find a way to download psycopg2 using homebrew. I have tried easy_install, pip install and sudo but all return errors like this...

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

Any help on how to fix this would be very much appreciated!

Thanks

Jess

(Sorry if this is a really simple problem to solve - this is my first django project)

解决方案

The first thing to do is to install the dependencies.

sudo apt-get build-dep python-psycopg2

After that go inside your virtualenv and use

pip install psycopg2 

These two commands should solve the problem.

这篇关于错误:没有名为psycopg2.extensions的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆