2

だから私はLinuxでPythonを使って画像処理をいじり始めています。だから私はコードを実行します

from PIL import Image
from pylab import *

im = array(Image.open('sample.jpg').convert('L'))

im2 = 255 - im
imshow(im)

figure()
imshow(im2)
figure()
im3 = (100.0/255)*im + 100
imshow(im3)
figure()
im4 = 255.0 * (im/255.0)**2
imshow(im4)
show()

フィギュアは4体作ります。これらの図を閉じて別のコードを実行したい場合、次のメッセージが表示されます。

Already Executing:
The Python Shell window is already
executing a command; please wait unit it is finished.

別のコマンドを実行するには、Python シェル ウィンドウを閉じる必要があります。別のスクリプトを実行するたびにpythonシェルを閉じる必要がないように、実行を適切に強制終了する方法はありますか?

4

2 に答える 2

0

do you have the same problem if you add exit() at the end of the script (after the call to show)?

Edit on Unix you should be able to interrupt the execution of a program/script with ctrl+c

于 2013-01-27T18:39:14.720 に答える
0

どの Python シェルを使用していますか? この動作は非常に珍しいようです。を使用する場合は、スレッド化の問題を回避するために -option をipython指定して ipython を実行してみてください。-pylab

ipython を使用していない場合は、使用しているバリアントをお知らせください。python? _ SpyderのようないくつかのIDE?それは本当に依存します。

正直なところ、ipython を使用することをお勧めします。

于 2013-01-28T06:14:16.217 に答える