我试图在FreeBSD 7.3的virtualenv下使用pip安装pysqlite
Python版本2.6.2.
我没有任何问题安装其他软件包,如Django,PIL等.所有这些我只是在激活virtualenv后安装.
但是我为pip install sqlite收到了一个巨大的错误.
这是错误的尾部
src/module.c:426: warning: implicit declaration of function 'sqlite3_libversion'
src/module.c:426: warning: passing argument 1 of 'PyString_FromString' makes pointer from integer without a cast
error: command 'gcc' failed with exit status 1
Command /usr/home/myuser/python-sites/virtpython/bin/python -c "import setuptools;__file__='/usr/home/myuser/python-sites/virtpython/build/pysqlite/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /usr/tmp/pip-N3U6Px-record/install-record.txt --single-version-externally-managed --install-headers /usr/home/myuser/python-sites/virtpython/include/site/python2.6 failed with error code 1 in /usr/home/myuser/python-sites/virtpython/build/pysqlite
Exception information:
Traceback (most recent call last):
File "/usr/home/myuser/python-sites/virtpython/lib/python2.6/site-packages/pip-1.2.1-py2.6.egg/pip/basecommand.py", line 107, in main
status = self.run(options, args)
File "/usr/home/myuser/python-sites/virtpython/lib/python2.6/site-packages/pip-1.2.1-py2.6.egg/pip/commands/install.py", line 261, in run
requirement_set.install(install_options, global_options)
File "/usr/home/myuser/python-sites/virtpython/lib/python2.6/site-packages/pip-1.2.1-py2.6.egg/pip/req.py", line 1166, in install
requirement.install(install_options, global_options)
File "/usr/home/myuser/python-sites/virtpython/lib/python2.6/site-packages/pip-1.2.1-py2.6.egg/pip/req.py", line 589, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/usr/home/myuser/python-sites/virtpython/lib/python2.6/site-packages/pip-1.2.1-py2.6.egg/pip/util.py", line 612, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/home/myuser/python-sites/virtpython/bin/python -c "import setuptools;__file__='/usr/home/myuser/python-sites/virtpython/build/pysqlite/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /usr/tmp/pip-N3U6Px-record/install-record.txt --single-version-externally-managed --install-headers /usr/home/myuser/python-sites/virtpython/include/site/python2.6 failed with error code 1 in /usr/home/myuser/python-sites/virtpython/build/pysqlite
‘virtpython’是我的虚荣心
% pkg_info | grep sqlite
sqlite-2.8.17_1 An SQL database engine in a C library
sqlite3-3.6.11 An SQL database engine in a C library
如果FreeBSD有一个sqlite开发包,我在哪里可以找到它?或者问题是别的?
解决方法:
我遇到了类似的问题,我发现的唯一解决方案是进入pip build dir(/ tmp / pip- {random hash},通常可以在错误的尾端找到,也可能是/usr/tmp /,或者命名为pysqlite,取决于你的设置)并改变pysqlite setup.cfg.下载时它看起来像这样:
[build_ext]
#define=
#include_dirs=/usr/local/include
#library_dirs=/usr/local/lib
libraries=sqlite3
define=SQLITE_OMIT_LOAD_EXTENSION
当我取消注释include_dirs和library_dirs时,pysqlite将安装正常.这样做的缺点是,我还没有找到一种方法来轻松实现这一步骤的自动化,因此需要在每个virtualenv设置中完成.它是丑陋的,令人不快的,并且在屁股上很痛苦,但确实让它安装了pysqlite.
希望这可以帮助.
PS
如果您尝试在virtualenv中运行pip安装,则可能会在{virtualenv} / build / pysqlite中找到下载的文件.