如何安装pysqlite?
我正在尝试安装 pysqlite (SQLite 的 Python 接口)。我下载了带有包的文件(pysqlite-2.5.5.tar.gz)。我做了以下事情:
gunzip pysqlite-2.5.5.tar.gz
tar xvf pysqlite-2.5.5.tar
\cd pysqlite-2.5.5
python setup.py install
在最后一步我遇到了问题。我收到以下错误消息:
error: command 'gcc' failed with exit status 1
据我了解,这个人有问题,因为没有安装 sqlite2。但就我而言,我有 sqlite3 (我可以从命令行运行它)。
也许我应该更改 "setup.cfg"
中的一些路径?目前我在那里:
#define=
#include_dirs=/usr/local/include
#library_dirs=/usr/local/lib
libraries=sqlite3
define=SQLITE_OMIT_LOAD_EXTENSION
如果我输入“which sqlite3”我得到:
/usr/bin/sqlite3
我在这里看到了类似的问题。答案是“你需要 sqlite3-dev”。但是,即使是这样,如何检查我是否有sqlite3-dev
。如果我没有它如何获得它?
有人可以帮我解决这个问题吗?
先感谢您。
I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following:
gunzip pysqlite-2.5.5.tar.gz
tar xvf pysqlite-2.5.5.tar
\cd pysqlite-2.5.5
python setup.py install
At the last step I have a problem. I get the following error message:
error: command 'gcc' failed with exit status 1
I found that other peoples also had this problem.
As far as I understood in the person had a problem because sqlite2 was not installed. But in my case, I have sqlite3 (I can run it from command line).
May be I should change some paths in "setup.cfg"
? At the moment I have there:
#define=
#include_dirs=/usr/local/include
#library_dirs=/usr/local/lib
libraries=sqlite3
define=SQLITE_OMIT_LOAD_EXTENSION
And if I type "which sqlite3" I get:
/usr/bin/sqlite3
I saw a similar question here. The answer was "you need sqlite3-dev". But, even if it is the case, how to check if I have sqlite3-dev
. And if I do not have it how to get it?
Can anybody pleas help me with that problem.
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
对于 Debian 发行版,我解决了这个问题
For Debian distros I fixed this problem with
我能够通过安装 sqlite-devel 包解决相同的构建错误:
I was able to resolve the same build error by installing the sqlite-devel package:
我遇到了同样的问题,我使用的是 python 2.4,
sqlite3-dev
和libsqlite3-dev
均不适用于 CentOS。似乎解决了问题。
I had the same problem, I'm using python 2.4, neither
sqlite3-dev
norlibsqlite3-dev
are available for CentOS.seems to solve the issue.
这完全取决于您使用的 Linux 发行版 - 是 Fedora、Suse、Ubuntu、Gentoo、Mandrake 还是其他几十个发行版中的哪一个;有多种打包策略和工具可用于检查存在哪些包、获取更多包等等。
因此,在没有指定感兴趣的发行版的情况下,永远不要询问有关在 Linux 上检查、获取或调整软件包的问题——这使得基本上不可能提供精确、具体的帮助。
编辑:我所知道的获取有关 Linux 发行版详细信息的最简单方法(适用于我手头尝试过的所有发行版,但我没有特别广泛的数组...;-) :
这可能是文件
/etc/lsb-release
的内容,但我建议使用*-release
因为我认为可能还有其他一些这样的内容涉及的文件。当然,如果需要检查您的发行版适用于文件或程序内部,则读取该文件(或多个文件)并定位特定内容也是相当可行的;但是为了让潜在的帮助者了解您正在使用的发行版,shell 提示符下的
cat
就足够了;-)。That's entirely dependent on what Linux distro you're using -- is it Fedora, Suse, Ubuntu, Gentoo, Mandrake, or which other one out of the dozens out there; there are several packaging strategies and tools used to check which packages are there, get more, and so forth.
So, never ask questions about checking, getting or tweaking packages on Linux without specifying the distribution[s] of interest -- it makes it essentially impossible to offer precise, specific help.
Edit: the simplest way I know of getting details about your Linux distribution (works on all the ones I have at hand to try, but I don't have a particularly wide array...;-):
This is probably going to be the contents of file
/etc/lsb-release
, but I'm suggesting the*-release
because I think there may be some other such files involved.Of course, if the need to check your distro applies inside a file or program, reading this file (or files) and locating specific contents will also be quite feasible; but for the purpose of informing would-be helpers about what distro you're using, the
cat
at the shell prompt is going to be quite sufficient;-).你有什么版本的Python? SQLite 从 2.5 开始就集成在 Python 中:
http://docs.python.org/library/sqlite3。 http://rpm.pbone.net/index.php3/stat/4/idpl
如果你坚持自己编译,这个包叫sqlite3-devel,你可以找到它,例如此处
What version of Python do you have? SQLite is integrated in Python since 2.5:
http://docs.python.org/library/sqlite3.html
If you insist on compiling it yourself, the package is called sqlite3-devel, you can find it e.g. here
您可以使用 yum 或 apt-get 代替
第一种类型:
你会得到类似 python-sqlite3dbm.noarch 的东西
,然后类型:
这样你的操作系统将安装你需要的所有内容,并且你不会收到错误
You could use yum or apt-get instead
first type :
you will get something like python-sqlite3dbm.noarch
then type :
this way your os will install all you need for you and you wont get errors
我在 CentOS 版本 5.6 上遇到以下编译错误:
安装 python-devel 也对我有帮助:
yum install python-devel
I had following compile errors on CentOS release 5.6:
Installing python-devel helped me too:
yum install python-devel
我是回答另一个问题的人:) 在使用 RPM 软件包的系统上,即您通常使用“yum”来安装东西,该软件包被命名为 sqlite3-devel。
在大多数基于 Debian 的系统上(即使用 apt-get 安装软件包),该软件包名为 sqlite3-dev。
这是两者之间非常典型的区别,大多数其他包都遵循相同的命名约定。
I'm the one who answered the other question :) On systems that use RPM packages, i.e. you normally use 'yum' to install things, the package is named sqlite3-devel.
On most Debian based systems (i.e. you use apt-get to install packages), the package is named sqlite3-dev.
This is a very typical difference between the two, most other packages follow the same naming convention.
我也遇到了同样的问题,gcc 在 Ubuntu Karmic 上失败了。我通过安装 python-dev 包修复了这个问题。就我而言,我正在使用 python2.4,因此我安装了 python2.4-dev 包。 python-dev 包应该适用于 python2.6。
I had the same trouble with gcc failing with Ubuntu Karmic. I fixed this by installing the python-dev package. In my case, I'm working with python2.4, so I installed the python2.4-dev package. The python-dev package should work for python2.6.
你安装了 python sqlite 库吗?
Did you install the python sqlite lib?
您需要安装插件 http://yum.baseurl.org/download/ yum-metadata-parser/
然后安装它
you need to install the plug in http://yum.baseurl.org/download/yum-metadata-parser/
then install it