简体   繁体   English

从另一个文件位置 python 导入 sqlite3.dll

[英]import sqlite3.dll from from another file location python

I new to python but how do I import the sqlite3.dll file from a custom file location as I can't find anything about it.我是 python 的新手,但是我如何从自定义文件位置导入 sqlite3.dll 文件,因为我找不到任何关于它的信息。 I can accept any option including building a new pyd,dll,etc file.我可以接受任何选项,包括构建新的 pyd、dll 等文件。

Edit: I need it to be in a separate location.编辑:我需要它在一个单独的位置。

Note: The following answers the above question with more thorough steps.注意:以下通过更彻底的步骤回答了上述问题。

I had the same issue as administrative rights to the default python library is blocked in a corporate environment and its extremely troublesome to perform installations.我遇到了与默认 python 库的管理权限相同的问题,该库在公司环境中被阻止,并且执行安装非常麻烦。

What works for me:什么对我有用:

  1. Duplicate the sqlite3 library in a new location在新位置复制 sqlite3 库
  2. Put in the latest sqlite3.dll (version you want from sqlite3 web) and the old _sqlite3.pyd into the new location or the new sqlite3 library.将最新的 sqlite3.dll(您想要的 sqlite3 web 版本)和旧的 _sqlite3.pyd 放入新位置或新的 sqlite3 库。 The old _sqlite3.pyd can be found in the default python library lib/DLLs folder.旧的 _sqlite3.pyd 可以在默认的 python 库 lib/DLLs 文件夹中找到。
  3. Go to the new sqlite3 library and amend the dbapi2.py as follows: Change "from _sqlite3 import *" to "from sqlite3._sqlite3 import *" Go 到新的 sqlite3 库并修改 dbapi2.py 如下:将“from_sqlite3 import *”更改为“from sqlite3._sqlite3 import *”
  4. Make sure python loads this new sqlite3 library first.确保 python 首先加载这个新的 sqlite3 库。 Add the path to this library if you must.如果必须,请添加此库的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM