I have created my virtual environment for a project:
python -m venv my_virtual_environment
cd my_project\Scripts
activate.bat
When the following code is executed:
import sys
print('\n Virtual environment: \n', sys.prefix)
import sqlite3
I get the following message:
Virtual environment:
my_path\my_project\my_virtual_environment
Traceback (most recent call last)
File ...
import sqlite3
File ...
from sqlite3.dbapi2 import *
File ...
from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.
According to I read it is not necessary to import sqlite3.
I tried with virtualenv
, as in the link, but I can't activate it.
If I create the virtual environment with Anaconda Navigator the code is executed correctly, but it creates the virtual environment directory in a subdirectory of Anaconda and not in the same directory of the project. This makes me wonder if when I create an executable with pyinstaller
it will work.
Edited 16 March 2020
Working specifications:
Windows
- Edition: Windows 10 Enterprise
- Version: 1803
- OS build: 17134.286
Python 3.7.6
CPU architecture
- Intel Core i7-8700K CPU 3.70 GHz
- RAM 32 GB
- 64 bits