简体   繁体   中英

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. I can accept any option including building a new pyd,dll,etc file.

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.

What works for me:

  1. Duplicate the sqlite3 library in a new location
  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. The old _sqlite3.pyd can be found in the default python library lib/DLLs folder.
  3. Go to the new sqlite3 library and amend the dbapi2.py as follows: Change "from _sqlite3 import *" to "from sqlite3._sqlite3 import *"
  4. Make sure python loads this new sqlite3 library first. Add the path to this library if you must.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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