➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 mariofutire
收信人 eric.snow, mariofutire, ncoghlan, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
日期 2018-10-10.19:28:14
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <0ba7d63a-70ae-6a0c-14e5-7409efbb7454@gmail.com>
In-reply-to <1539130289.56.0.545547206417.issue34725@psf.upfronthosting.co.za>
内容
On 10/10/2018 01:11, Steve Dower wrote:
> 
> Steve Dower <steve.dower@python.org> added the comment:
> 
> We'll need to bring in venv specialists to check whether using it outside of Py_Main() is valid. Or perhaps you could explain what you are actually trying to do?
> 

Sure

1) Create a virtual environment ("python -m venv")
2) Activate
2) Pip install some modules
3) Try to use them form inside an embedded application (e.g. the one I attached)
4) Do it in Linux and Windows

Result

Works in Linux, fails in Windows.

Reason in site.py

https://github.com/python/cpython/blob/73870bfeb9cf350d84ee88bd25430c104b3c6191/Lib/site.py#L462

sys.executable is used to construct the correct search path.

Looking at the sys.path from inside an embedded application is very instructive and you can see in 
the first post why the failure in windows.

Andrea
历史
日期 用户 动作 参数
2018-10-10 19:28:14mariofutire修改recipients: + mariofutire, paul.moore, ncoghlan, vstinner, tim.golden, eric.snow, zach.ware, steve.dower
2018-10-10 19:28:14mariofutire链接issue34725 messages
2018-10-10 19:28:14mariofutire创建