English 中文(简体)
qlite3。 相联物体无属性 • 有效载荷
原标题:sqlite3.Connection object has no attribute enable_load_extension

关于python3.7.4 装载qlite3模块,并要求使_load_extension能够:

import sqlite3
conn=sqlite3.connect("./tests/data/ne_110m_admin_0_countries.sqlite")
conn.enable_load_extension(True)

AttributeError: sqlite3.Connection object has no attribute enable_load_extension

我理解缺席的《乌班图》(sqlite3)一揽子计划,正在装满载荷后停用。 我遵循了这一准则:

基本上,使用<代码>pyenv<>/code>和python 3.7.4,在相互交错模式一上,也可看到使用装载延伸旗,同时沿上方和重新安装浮质板3

Running python on verbose mode:

>>> import sqlite3
# /home/jesus/.pyenv/versions/3.7.4/lib/python3.7/sqlite3/__pycache__/__init__.cpython-37.pyc matches /home/jesus/.pyenv/versions/3.7.4/lib/python3.7/sqlite3/__init__.py

进入单元的道路是正确的。

3. 利用三轮驱动器:

jesus@earth:~/.pyenv/versions/3.7.4/bin$ sqlite3
SQLite version 3.31.0 2019-11-16 12:04:38
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> SELECT sqlite_compileoption_used( ENABLE_LOAD_EXTENSION );
1

我看到,这片泥石是用适当的选择建造的。

我从未有过同样的错误:AttributeError: sqlite3。 相联物体没有属性 • 有效载荷-延伸

Update Requesting by SQL, if the library was compiled with load extension loading the reply is positive

cursor=conn.cursor() 
res=cursor.execute("SELECT sqlite_compileoption_used( ENABLE_LOAD_EXTENSION );") 
res.fetchall() [(1,)]

在我为缓解这一问题而做的更大努力上,我失去了。 这发生在日元建筑上。

任何ti?

最佳回答

必须用强化的系统变数来安装这一天线,供选用。 对我来说,这项工作是:

# Do the following in your shell
LDFLAGS="-L/usr/local/opt/sqlite/lib -L/usr/local/opt/zlib/lib" CPPFLAGS="-I/usr/local/opt/sqlite/include -I/usr/local/opt/zlib/include" PYTHON_CONFIGURE_OPTS="--enable-loadable-sqlite-extensions" pyenv install 3.7.6
问题回答

对于那些使用MacOS、 b和Pyenv的人:

brew install sqlite
LDFLAGS="-L$(brew --prefix sqlite)/lib" CPPFLAGS="-I$(brew --prefix sqlite)/include" PYTHON_CONFIGURE_OPTS="--enable-loadable-sqlite-extensions" pyenv install -v 3.11.4




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签