我用pyinstaller打包django项目,打包成功后,运行项目:
.\runserver.exe
报错:
Traceback (most recent call last):
File "runserver.py", line 1, in <module>
ModuleNotFoundError: No module named 'django'
[19204] Failed to execute script 'runserver' due to unhandled exception!
在网上没有找到原因,于是去看打包命令
154 INFO: PyInstaller: 5.11.0
154 INFO: Python: 3.9.6
166 INFO: Platform: Windows-10-10.0.22621-SP0
167 INFO: UPX is not available.
169 INFO: Extending PYTHONPATH with paths
['E:\\Project\\peopleinfo\\personinfo']
pygame 2.4.0 (SDL 2.26.4, Python 3.9.6)
Hello from the pygame community. https://www.pygame.org/contribute.html
681 INFO: Appending 'datas' from .spec
792 INFO: checking Analysis
804 INFO: Building because hiddenimports changed
804 INFO: Initializing module dependency graph...
806 INFO: Caching module graph hooks...
823 INFO: Analyzing base_library.zip ...
2197 INFO: Loading module hook 'hook-encodings.py' from 'c:\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
3255 INFO: Loading module hook 'hook-pickle.py' from 'c:\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
3878 INFO: Loading module hook 'hook-heapq.py' from 'c:\\python39\\lib\\site-package