找不到符号:_sqlite3_enable_load_extension-通过自制程序安装的sqlite [英] Symbol not found: _sqlite3_enable_load_extension - sqlite installed via homebrew

查看:469
本文介绍了找不到符号:_sqlite3_enable_load_extension-通过自制程序安装的sqlite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

症状:在我的Django应用程序中,当我调用from pysqlite2._sqlite import *时,我得到了回溯Symbol not found: _sqlite3_enable_load_extension

Symptom: In my Django app, when I call from pysqlite2._sqlite import * I get the traceback Symbol not found: _sqlite3_enable_load_extension when

背景:

  • 我已经使用homebrew(python 2.7.13)安装了python,它会自动安装sqlite
  • 我正在使用命令行工具macOS 10.12,Xcode 8.2.1运行macOS 10.12.3
  • 我已经使用pip(pysqlite 2.8.3)安装了pysqlite

我尝试过

  • brew uninstall sqlitebrew uninstall python并重新安装
  • 将这些添加到我的.bash_profile

  • brew uninstall sqlite and brew uninstall python and reinstalling
  • Adding these to my .bash_profile

export PATH="$(brew --prefix sqlite)/bin:$PATH"
LDFLAGS="-L/usr/local/opt/sqlite/lib"
CPPFLAGS="-I/usr/local/opt/sqlite/include"
export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"

  • python -c"import sqlite3"不返回任何错误

  • python -c "import sqlite3" doesn't return any errors

    追溯要点: https://gist.github.com/xwchen/e9704fa34f0463d2117fe9fbb37922a1

    推荐答案

    从此处复制的答案( https://github.com/Homebrew/homebrew-core /pull/3134 ).如果您像我一样,则可能在安装python3之后安装了sqlite.无论如何,如果有人偶然发现了这个问题并需要答案...

    Copied answer from here (https://github.com/Homebrew/homebrew-core/pull/3134). If you're like me, you probably installed sqlite after you install python3. Anyway, if anyone stumbles upon this question and needs an answer...

    如果通过自制软件安装,请先删除SQLite,python和python3

    First remove SQLite, python and python3 if installed via homebrew

    brew uninstall --force python
    brew uninstall --force python3
    brew uninstall --force sqlite
    

    这将删除所有副本.

    然后确保已安装Xcode 8或更高版本

    Then make sure Xcode 8 or later is installed

    重要

    通过

    xcode-select --install
    sudo xcode-select --reset
    

    最后通过在此处中找到的pkg文件安装命令行工具.

    and finally install command line tools via pkg file found here.

    在搜索中寻找命令行工具. (我已经下载了用于Xcode 8.dmg的命令行工具(macOS 10.12)"),然后打开DMG并安装在那里找到的pkg.

    Look for command line tools in search. (I've downloaded "Command Line Tools (macOS 10.12) for Xcode 8.dmg") Then open DMG and install the pkg found there.

    现在安装SQLite,然后根据需要安装python和python 3:

    Now install SQLite and then python and python 3 if needed:

    brew install sqlite
    brew install python
    brew install python3
    

    运行brew install python --verbose并确保没有警告,如果没有警告,则应该解决问题.

    Run brew install python --verbose and make sure there are no warnings, if none then issues should be resolved.

    别忘了做

    pip install setuptools --upgrade && pip3 install setuptools --upgrade
    

    这篇关于找不到符号:_sqlite3_enable_load_extension-通过自制程序安装的sqlite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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