English 中文(简体)
PowerShell的Run python来文方档案
原标题:Run python source file from PowerShell

我试图学习 p,但有一些问题从电壳中掌握源文档。 当我打上 p时,我可以直接打上粉.。 我认为这是一种互动模式。 但是,当我试图管理/处理一个来源档案时,我收到一个错误的信息: 它说的是:Syntax错误:无效的辛加税。

我使用我的档案。 在我试图执行这本书时,我感到悲伤。

If I run the same file from IDLE it works just fine. Ana idea what I m doing wrong?

这里是我的档案。 I m 运行 pthon 2.7

 # filename: myfile.py

while True:
      s = raw_input( Enter something:  )
      if s ==  Quit :
          break
      print  Lenght of the string is , len(s)
print  Done 
最佳回答

你们需要在指挥线内铺设一条可起诉的沙捞越道路,以便工作。 你们可以检查并确保你在你的“路边”中包含在你的系统变量中。

问题回答

You might have more than one version of Python installed and the version IDLE is using is newer. To see what version of python you have you can type >python -V at a command line. If that version looks appropriate then you might need the full path to the file as the second parameter. E.g >python C:myfile.py.

If you installed Python correctly there is always a chance that just typing the name of the script will run it with python. E.g. >myfile.py

我总是认为,在<条码>上添加<条码>C:Python27>>>>,将>%PATH% 变量和。 缩略语 在这种情况下,只有<代码>>myfile

www.un.org/spanish/ecosoc Edit after Update:

仅打上<代码>>python <>/code>,没有任何参数以互动方式开标,这与你的文字所要用的批量或描述方式不同。 第一种论点如经论证后被采纳为档案途径,而进一步的论点则转至<编码>sys.argv清单中的文字。

申斥: 我不知道PowerShell,但我确实知道过细。

我不知道为什么<代码>python myfile。 py 做不到工作,但假定这一权力 壳牌至少具有某种相似性,其范围可能如下:myfile.py。 这项权利,只是进入了Zazzat的名号并进入。

如果您开始在<代码>中打上“python> 你们需要从这一文字中删除。

1. 如果你处于 p状态:

quit() then type python myfile.py

如果正确安装了你的雕像,就应当这样做。

在强国进行这种分类:

$env:path="$env:Path;C:Python33

之后,指挥

python yourfile.py

should work.

我很sil,特别是来自一个开端的人。

仅节省桌面上的文件。 开放权力,将档案直接投入权力,并开放。 of,但行之有效





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签