Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
181 views
in Technique[技术] by (71.8m points)

python - virtualenv Env not creating bin directory in Windows 7

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

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

It only creates:

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

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).

I'm using Windows 7 and Python 2.7.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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

For Windows, run pathoenvScriptsactivate to activate the virtualenv. From the documentation again:

On Windows you just do:

> pathoenvScriptsactivate

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...