gpt4 book ai didi

python - virtualenv Env 未在 Windows 7 中创建 bin 目录

转载 作者:IT老高 更新时间:2023-10-28 22:07:18 26 4
gpt4 key购买 nike

我是 Python 的新手,我在这方面花了好几个小时。我似乎无法弄清楚为什么当我运行一个简单的命令来设置我的 Python 环境时:virtualenv --distribute env

这不会在 env 目录中创建 bin 文件。

它只创建:

-- env
-- Include
-- Lib
-- Scripts

我的印象是,我在网上找到的许多示例都会创建一个 bin 目录(例如,我无法运行此命令:env/bin/activate )。

我使用的是 Windows 7 和 Python 2.7。

最佳答案

在 Windows 上,这是完全正确的。 bin 目录仅在 POSIX 系统上创建。来自 Windows Notes文档部分:

Some paths within the virtualenv are slightly different on Windows: scripts and executables on Windows go in ENV\Scripts\ instead of ENV/bin/ and libraries go in ENV\Lib\ rather than ENV/lib/.

对于 Windows,运行 \path\to\env\Scripts\activate 来激活 virtualenv。来自 documentation再次:

On Windows you just do:

> \path\to\env\Scripts\activate

And type deactivate to undo the changes.

Based on your active shell (CMD.exe or Powershell.exe), Windows will use either activate.bat or activate.ps1 (as appropriate) to activate the virtual environment.

关于python - virtualenv Env 未在 Windows 7 中创建 bin 目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13206990/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com