如何安装pysqlite?

发布于 2024-08-05 09:14:11 字数 948 浏览 6 评论 0原文

我正在尝试安装 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

善良天后 2024-08-12 09:14:11

对于 Debian 发行版,我解决了这个问题

sudo apt-get install libsqlite3-dev

For Debian distros I fixed this problem with

sudo apt-get install libsqlite3-dev
任性一次 2024-08-12 09:14:11

我能够通过安装 sqlite-devel 包解决相同的构建错误:

sudo yum install sqlite-devel

I was able to resolve the same build error by installing the sqlite-devel package:

sudo yum install sqlite-devel
眼泪都笑了 2024-08-12 09:14:11

我遇到了同样的问题,我使用的是 python 2.4,sqlite3-devlibsqlite3-dev 均不适用于 CentOS。

yum install python-devel

似乎解决了问题。

I had the same problem, I'm using python 2.4, neither sqlite3-dev nor libsqlite3-dev are available for CentOS.

yum install python-devel

seems to solve the issue.

泪冰清 2024-08-12 09:14:11

如何检查我是否有“sqlite3-dev”

这完全取决于您使用的 Linux 发行版 - 是 Fedora、Suse、Ubuntu、Gentoo、Mandrake 还是其他几十个发行版中的哪一个;有多种打包策略和工具可用于检查存在哪些包、获取更多包等等。

因此,在没有指定感兴趣的发行版的情况下,永远不要询问有关在 Linux 上检查、获取或调整软件包的问题——这使得基本上不可能提供精确、具体的帮助。

编辑:我所知道的获取有关 Linux 发行版详细信息的最简单方法(适用于我手头尝试过的所有发行版,但我没有特别广泛的数组...;-) :

$ cat /etc/*-release
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu 8.04.2"
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
...etc, etc...

这可能是文件 /etc/lsb-release 的内容,但我建议使用 *-release 因为我认为可能还有其他一些这样的内容涉及的文件。

当然,如果需要检查您的发行版适用于文件或程序内部,则读取该文件(或多个文件)并定位特定内容也是相当可行的;但是为了让潜在的帮助者了解您正在使用的发行版,shell 提示符下的 cat 就足够了;-)。

how to check if I have "sqlite3-dev"

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...;-):

$ cat /etc/*-release
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu 8.04.2"
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
...etc, etc...

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;-).

情未る 2024-08-12 09:14:11

你有什么版本的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

我很坚强 2024-08-12 09:14:11

您可以使用 yum 或 apt-get 代替
第一种类型:

    sudo yum(or apt-get) search python-sqlite3

你会得到类似 python-sqlite3dbm.noarch 的东西

,然后类型:

    sudo yum(or apt-get) install python-sqlite3dbm.noarch

这样你的操作系统将安装你需要的所有内容,并且你不会收到错误

You could use yum or apt-get instead
first type :

    sudo yum(or apt-get) search python-sqlite3

you will get something like python-sqlite3dbm.noarch

then type :

    sudo yum(or apt-get) install python-sqlite3dbm.noarch

this way your os will install all you need for you and you wont get errors

软的没边 2024-08-12 09:14:11

我在 CentOS 版本 5.6 上遇到以下编译错误:

src/cache.h:34: error: expected specifier-qualifier-list before 'PyObject_HEAD'
src/cache.h:44: error: expected specifier-qualifier-list before 'PyObject_HEAD'
src/cache.h:61: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'pysqlite_NodeType'
src/cache.h:62: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'pysqlite_CacheType'
src/cache.h:64: error: expected declaration specifiers or '...' before 'PyObject'
src/cache.h:64: error: expected declaration specifiers or '...' before 'PyObject'
src/cache.h:67: error: expected declaration specifiers or '...' before 'PyObject'
src/cache.h:67: error: expected declaration specifiers or '...' before 'PyObject'

安装 python-devel 也对我有帮助:

yum install python-devel

I had following compile errors on CentOS release 5.6:

src/cache.h:34: error: expected specifier-qualifier-list before 'PyObject_HEAD'
src/cache.h:44: error: expected specifier-qualifier-list before 'PyObject_HEAD'
src/cache.h:61: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'pysqlite_NodeType'
src/cache.h:62: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'pysqlite_CacheType'
src/cache.h:64: error: expected declaration specifiers or '...' before 'PyObject'
src/cache.h:64: error: expected declaration specifiers or '...' before 'PyObject'
src/cache.h:67: error: expected declaration specifiers or '...' before 'PyObject'
src/cache.h:67: error: expected declaration specifiers or '...' before 'PyObject'

Installing python-devel helped me too:

yum install python-devel

春庭雪 2024-08-12 09:14:11

我是回答另一个问题的人:) 在使用 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.

御弟哥哥 2024-08-12 09:14:11

我也遇到了同样的问题,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.

许一世地老天荒 2024-08-12 09:14:11

你安装了 python sqlite 库吗?

sudo apt-get install python-sqlite

Did you install the python sqlite lib?

sudo apt-get install python-sqlite
国粹 2024-08-12 09:14:11

您需要安装插件 http://yum.baseurl.org/download/ yum-metadata-parser/

wget -c "http://yum.baseurl.org/download/yum-metadata-parser/yum-metadata-parser-1.1.4.tar.gz"

然后安装它

tar zxf yum-metadata-parser-1.1.4.tar.gz && cd yum-metadata-parser-1.1.4
/path/to/python setup.py install

you need to install the plug in http://yum.baseurl.org/download/yum-metadata-parser/

wget -c "http://yum.baseurl.org/download/yum-metadata-parser/yum-metadata-parser-1.1.4.tar.gz"

then install it

tar zxf yum-metadata-parser-1.1.4.tar.gz && cd yum-metadata-parser-1.1.4
/path/to/python setup.py install
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文