Unable to import sqlite3 using Anaconda Python

喜你入骨 提交于 2019-12-04 03:05:04

问题


I am trying to do the following in Python 3.7.1 on Windows

import sqlite3

but I get the following error message

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "c:\programdata\anaconda3\lib\sqlite3\__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "c:\programdata\anaconda3\lib\sqlite3\dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.

I have searched for a solution to the problem for quite a while now to no avail. I have also successfully run pip install pysqlite3 on the Anaconda prompt, but the import still fails. What do?


回答1:


I got this working on windows by downloading: the sqlite3 dll (find your system version)

And putting into the folder: C:\Users\YOURUSER\Anaconda3\DLLs

(Depending on how you installed Anaconda, this may have to be placed into the following folder: C:\ProgramData\Anaconda3\DLLs)




回答2:


Please check https://github.com/jupyter/notebook/issues/4332 I added anaconda root/Library/bin to my PATH and now it works!




回答3:


before executing the program, enter conda activate in your shell.



来源:https://stackoverflow.com/questions/54876404/unable-to-import-sqlite3-using-anaconda-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!