Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; '(at': 0.04; 'interpreter': 0.05; 'python3': 0.07; 'permissions': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'jan': 0.12; 'windows': 0.15; "'.py'": 0.16; 'executed;': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'supplying': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'typing': 0.19; 'header:User-Agent:1': 0.23; 'interpret': 0.24; 'lets': 0.24; 'script.': 0.24; 'specifies': 0.24; 'script': 0.25; 'header:X-Complaints-To:1': 0.27; 'header :In-Reply-To:1': 0.27; 'file': 0.32; 'run': 0.32; 'there': 0.35; 'version': 0.36; 'entry': 0.36; 'operating': 0.37; 'two': 0.37; 'being': 0.38; 'system,': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'skip:. 10': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'john': 0.61; 'received:173': 0.61; 'first': 0.61; 'name': 0.63; 'choose': 0.64; 'between': 0.67; 'present.': 0.74; 'received:fios.verizon.net': 0.84; 'skip:/ 30': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: running python 2 vs 3 Date: Thu, 20 Mar 2014 18:05:49 -0400 References: <87ob10nbeh.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395353168 news.xs4all.nl 2934 [2001:888:2000:d::a6]:46215 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68630 On 3/20/2014 3:07 PM, John Gordon wrote: > There are two ways (at least!) to run a python script: > > 1. Execute the python interpreter manually, supplying the python script name > as an arugment, like so: > > python myscript.py > python2 otherscript.py > python3 yetanotherscript.py > > This lets you choose on-the-fly which version of python is being used to > interpret the script. > > 2. Execute the python script directly by just typing its name, like so: > > myscript.py > ./otherscript.py > /other/directory/yetanotherscript.py > > Depending on your operating system, this may require: > a. Permissions on the script file be set to allow execution; > b. A 'shebang' entry as the first line in the file which specifies the > program that shall be executed; c. An association between '.py' and some version of python. 3. Use the python launcher py.exe with version selection. py -2 myscript.py py -3 myscript.py As far as I know, this is only for Windows at present. -- Terry Jan Reedy