问题描述
我已经编译了 SQLite3 3.8.6 并将其安装到 ${HOME}/opt 中:
I have compiled SQLite3 3.8.6 and installed it to ${HOME}/opt with:
LDFLAGS="-L${HOME}/opt/lib" CFLAGS="-L${HOME}/opt/include" ./configure --prefix=$HOME/opt
make && make install
我现在正在尝试编译 Python 3.4.2 以使用此版本而不是为整个系统安装的版本.我在这个系统上没有 root 访问权限.要编译 Python,我使用:
I am now trying to compile Python 3.4.2 to use this version instead of the version installed for the entire system. I do not have root access on this system. To compile Python, I am using:
LDFLAGS="-L${HOME}/opt/lib" CFLAGS="-L${HOME}/opt/include" ./configure --prefix=$HOME/opt
make && make install
如果使用 SQLite3,我可以用我的较新版本编译 Python 3.3.5,但这些相同的步骤似乎不适用于 3.4.2.
I was able to compile Python 3.3.5 with my newer version if SQLite3, but these same steps don't seem to work for me for 3.4.2.
如何编译 Python 3.4.2 以包含我位于 ${HOME}/opt 中的 SQLite 3.8.6 版本?
How can I compile Python 3.4.2 to include my version of SQLite 3.8.6 which is located in ${HOME}/opt?
谢谢.
它编译&安装正常,除了使用旧的系统版本的 sqlite3 而不是我编译的版本 &自己安装.
It compiles & installs OK except for the fact that is using the older, system version of sqlite3 instead of the version that I compiled & installed myself.
推荐答案
还可以选择将自定义 Python 构建与您自己构建的 sqlite3 预先链接.(我遇到了同样的问题:自定义 python 使用的是系统提供的 sqlite3,完全忽略了我构建的 sqlite3).
There is also the option of pre-linking your custom Python build with your own-built sqlite3. (I had the same issue: the custom python was using the system-provided sqlite3, completely ignoring the sqlite3 I built).
在 configure
和 make
命令前加上:
Prefix your configure
and make
commands with:
LD_RUN_PATH=$HOME/opt/lib configure LDFLAGS="-L$HOME/opt/lib" CPPFLAGS="-I$HOME/opt/include" …
LD_RUN_PATH=$HOME/opt/lib make
这样内置的 python3
默认链接到你的 sqlite3.这对我有用.
so that the built python3
by default is linked to your sqlite3.This worked for me.
这篇关于用 sqlite3 编译 Python 3.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!