首页 > 其他 > 详细

Command Line 3

时间:2016-11-02 08:02:16      阅读:278      评论:0      收藏:0      [点我收藏+]

Python Script:

1. Add some lines into a blank file: 

  echo "hello world" >> text.txt.

  Everytime before create a script file. we have some steps:

  a. Create a .script file by using mkdir text.script

  b. add some lines into the script to make sure the file is allowed to run under the shell:

    echo ‘if __name__ == "__main__":\n    print("Welcome to a Python script")‘ > script.py # here we are using single bracket on each side of echo word.Pay attention that there are four space before print.

    

2.  We can use python2 to call the script:

  python text.script 

   Or use python3 to call the script:

  python3 text.script 

  Here, we can use python3 or python2 to call the script. But sometimes, if several project want to call a same library in different version. 

3.  Why we want to use virtual environment:

  技术分享

 So if we use virtual environment:

    

技术分享

 

    

Command Line 3

原文:http://www.cnblogs.com/kingoscar/p/6021627.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!