virtualenv Env 未在 Windows 7 中创建 bin 目录 [英] virtualenv Env not creating bin directory in Windows 7

查看:43
本文介绍了virtualenv Env 未在 Windows 7 中创建 bin 目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm a newbie to Python and I've spent hours on this. I can't seem to figure out why when I run a simple command to setup my Python environment: virtualenv --distribute env

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

This doesn't create a bin file in the env directory.

它只会创建:

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

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

My impressions was that a bin directory would be created per a lot of the examples I've found on the web (e.g. I'm not able to run this command: env/bin/activate).

我使用的是 Windows 7 和 Python 2.7.

I'm using Windows 7 and Python 2.7.

推荐答案

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

On Windows, this is entirely correct. A bin directory is created on POSIX systems only. From the Windows Notes section of the documentation:

virtualenv 中的一些路径在 Windows 上略有不同:Windows 上的脚本和可执行文件在 ENV\Scripts\ 而不是 ENV/bin/ 和库在 ENV\Lib\ 而不是 ENV/lib/.

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.再次来自文档:

For Windows, run \path\to\env\Scripts\activate to activate the virtualenv. From the documentation again:

在 Windows 上,您只需:

On Windows you just do:

<代码>>\path\to\env\Scripts\activate

然后输入 deactivate 以撤消更改.

And type deactivate to undo the changes.

根据您的活动 shell(CMD.exe 或 Powershell.exe),Windows 将使用 activate.batactivate.ps1(视情况而定)来激活虚拟环境.

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.

这篇关于virtualenv Env 未在 Windows 7 中创建 bin 目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆