码迷,mamicode.com
首页 > 其他好文 > 详细

Command Line 3

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

标签:name   virtual   rip   att   add   ges   print   hello   ever   

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

标签:name   virtual   rip   att   add   ges   print   hello   ever   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!