Python Embeddable Zip File Doesn't Include lib/site-packages in sys.path

牧云@^-^@ 提交于 2019-11-30 22:52:03

After extracting the Python embeddable zip file, there is a file called "python36._pth" in the root directory. That file contains the following text:

# Uncomment to run site.main() automatically
#import site

As the comment indicates, simply uncomment the import site statement by removing the '#' character. After doing so, the sys.path variable contains:

'...\\python36.zip'
'...'
'...\\\n'
'...\\lib\\site-packages'

This is still different than the installed version, but is exactly what I needed in my particular case.

BEGIN EDIT

I also discovered that you can remove the "python36._pth" file entirely, which reverts Python to behavior of the non-embeddable version.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!