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
779 views
in Technique[技术] by (71.8m points)

command line - python packages open new window

I installed python27 64-bit on windows 7. I also have setuptools and pip installed. Now when I execute command in windows console new console window appear, message is printed in it and close before i can read something from it. e. g. I installed yolk and when type yolk -l in cmd it shows me all packages in new cmd window and close immediately. What should I do if I want all messages in main command window?

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

When you run pip or easy_install from the command-line, your system will be starting easy_install.exe or pip.exe. As of Python 2.7 x64 these executables have a manifest file to satisfy Windows 7's UAC requirements. You can read a little more about this here, but in short, because the applications could be running with different permissions, a new window is opened.

I don't believe there's a proper fix to get around this, short of downgrading. However, you can bypass the problem by not using the executable files.

Back up and then remove pip.exe, easy_install.exe, and fab.exe (if you have Fabric).

Create a bunch of batch files matching the original binaries' names, and put them in the same folder that had the binaries (default C:Python27Scripts).

easy_install.bat

@echo off
easy_install-script.py %*

pip.bat

@echo off
pip-script.py %*

fab.bat

@echo off
fab-script.py %*

With these in place, you should find your command-line use of these tools doesn't spawn a new window. Happy hacking.


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

...