Nuitka/Nuitka
Auf GitHub ansehenSelf compiled uninstalled Windows Python not working with venv, maybe others
Open
#2.992 geöffnet am 10. Juli 2024
enhancementhelp wanted
Repository-Metriken
- Stars
- (10.351 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 5T 12h) (6 gemergte PRs in 30 T)
Beschreibung
Python 3.9.17 / Windows 11 cryptography==42.0.8 Nuitka==2.3.11
Script:
# test.py
from cryptography.fernet import Fernet
if __name__ == '__main__':
print(Fernet.generate_key())
"ImportError" when packaging with virtual environment
python -m venv venv
venv\Scripts\activate.bat
...
python -m nuitka --onefile test.py
# Running test.exe shows the following error
from cryptography.fernet import Fernet
File "C:\Users\ADMIN\AppData\Local\Temp\ONEFIL~1\cryptography\fernet.py", line 14, in <module cryptography.fernet>
File "C:\Users\ADMIN\AppData\Local\Temp\ONEFIL~1\cryptography\exceptions.py", line 9, in <module cryptography.exceptions>
ImportError
But everything works fine when I use a non-virtual Python environment.
I'm also getting the same error when using Python 3.10 and Python 3.11 virtual environments.
Strangely enough, it works as expected in Python 3.8, regardless of whether I'm using a virtual environment or not.