私は、Microsoft Windows 7でIDLE 2.7.6のpython 2.7.6を使用しています。IDLE変数の登録に失敗しました。そんなことがあるものか?
IDLEは、下の画像のように変数(名前はx5
)を登録できませんでした。そんなことがあるものか?問題をトリガーするために取ら
アクション:
次は私のIDLEコンソール履歴にすでにある:
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x5 = 4
私はは、このコピーは、次の
を入力してEnterキーを押し
x5 = 4
- 上のどこかにカーソルを置きます。コピーした後
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x5 = 4
、カーソルが自動的に配置されます末尾は
x5 = 4
です。私はx5
が値4私は
x5
の値をチェックするx5
を型を取ることを期待して、は再びをEnterキーを押します。私はBlckknghtの回答やコメントをもとに>>> x5
Traceback (most recent call last):
File "<pyshell#118>", line 1, in <module>
x5
NameError: name 'x5' is not defined
を取得し、それが見えます私はコピー最初の場所でIDLEコンソールで(>>>
含む)一度に次の2行を貼り付けていたのと同様に:結果
x1 = np.arange(9.0).reshape((3, 3))
>>> x5 = 4
IDLEだけを気にするので、ライン>>> x5 = 4
は単に、無視されました最初に表示されるpython文です。
全体IDLEログ:
Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> '#' *3
'###'
>>> import numpy as np
>>> a=np.random.random((3, 3))
>>> b=np.random.random((3, 3))
>>> a
array([[ 0.92731349, 0.48377097, 0.32175387],
[ 0.65061308, 0.72905101, 0.65499733],
[ 0.1334612 , 0.4023123 , 0.50179231]])
>>> b
array([[ 0.35232561, 0.77837691, 0.70645223],
[ 0.51114669, 0.83303289, 0.78842767],
[ 0.51179183, 0.25109079, 0.91229917]])
>>> a*b
array([[ 0.32671629, 0.37655615, 0.22730374],
[ 0.33255872, 0.60732347, 0.51641802],
[ 0.06830435, 0.10101691, 0.45778471]])
>>> a = [[1, 0], [0, 1]]
>>> b = [[4, 1], [2, 2]]
>>> a = [[3, 4], [2, 1]]
>>> a
[[3, 4], [2, 1]]
>>> b
[[4, 1], [2, 2]]
>>> np.dot(a, b)
File "<pyshell#12>", line 1
np.dot(a, b)
^
IndentationError: unexpected indent
>>> np.dot(a, b)
array([[20, 11],
[10, 4]])
>>> a = [[1, 2]]
>>> a.dot(b)
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
a.dot(b)
AttributeError: 'list' object has no attribute 'dot'
>>> a = np.array([[1, 2]])
>>> a.dot(b)
array([[8, 5]])
>>> a = np.array([[3,4]])
>>> b= = np.array([[3,4]])
SyntaxError: invalid syntax
>>> b= np.dot(a, b)
np.array([[3,4]])
>>> a*b
array([[60, 44]])
>>> a
array([[3, 4]])
>>> b
array([[20, 11]])
>>> np.dot(a, b)
Traceback (most recent call last):
File "<pyshell#24>", line 1, in <module>
np.dot(a, b)
ValueError: objects are not aligned
>>>
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(3.0)
>>> np.multiply(x1, x2)
array([[ 0., 1., 4.],
[ 0., 4., 10.],
[ 0., 7., 16.]])
>>> x1
array([[ 0., 1., 2.],
[ 3., 4., 5.],
[ 6., 7., 8.]])
>>> z2
Traceback (most recent call last):
File "<pyshell#30>", line 1, in <module>
z2
NameError: name 'z2' is not defined
>>> x2
array([ 0., 1., 2.])
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(9.0).reshape((3, 3))
>>> np.multiply(x1, x2)
array([[ 0., 1., 4.],
[ 0., 4., 10.],
[ 0., 7., 16.]])
>>> x1
array([[ 0., 1., 2.],
[ 3., 4., 5.],
[ 6., 7., 8.]])
>>> x2
array([ 0., 1., 2.])
>>> x2
array([ 0., 1., 2.])
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(9.0).reshape((3, 3))
>>> x2
array([ 0., 1., 2.])
>>> x1
array([[ 0., 1., 2.],
[ 3., 4., 5.],
[ 6., 7., 8.]])
>>> x2
array([ 0., 1., 2.])
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(9.0).reshape((3, 3))
>>> x2
array([ 0., 1., 2.])
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(9.0)
>>> x2
array([ 0., 1., 2.])
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = 3
>>> x2
array([ 0., 1., 2.])
>>> x1=1
>>> x1
1
>>> x2 = 3
>>> x2
3
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(9.0)
>>> x2
3
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(9.0)
>>> x2
3
>>> x1
array([[ 0., 1., 2.],
[ 3., 4., 5.],
[ 6., 7., 8.]])
>>> x1x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(9.0)
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x2 = np.arange(9.0)
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x3 = np.arange(9.0)
>>> x3
Traceback (most recent call last):
File "<pyshell#60>", line 1, in <module>
x3
NameError: name 'x3' is not defined
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x3 = 4
>>> x3
Traceback (most recent call last):
File "<pyshell#62>", line 1, in <module>
x3
NameError: name 'x3' is not defined
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x4 = 4
>>> x4
Traceback (most recent call last):
File "<pyshell#64>", line 1, in <module>
x4
NameError: name 'x4' is not defined
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x4 = 4
>>> x4
Traceback (most recent call last):
File "<pyshell#78>", line 1, in <module>
x4
NameError: name 'x4' is not defined
>>> x4 = 4
>>> x4
4
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x4 = 4
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x5 = 5
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x5 = 4
>>> x5
Traceback (most recent call last):
File "<pyshell#84>", line 1, in <module>
x5
NameError: name 'x5' is not defined
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x5 = 4
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x5 = 4
>>> x1 = np.arange(9.0).reshape((3, 3))
>>> x5 = 4
>>> x5
Traceback (most recent call last):
File "<pyshell#104>", line 1, in <module>
x5
NameError: name 'x5' is not defined
>>>
あなたのコードを実行するIDLEではなく、Pythonであり、エラーメッセージを生成しています。インストールに何か問題があるようです。 IDLEのないインタラクティブなPythonで同じことをするとどうなりますか?インタラクションをコピーして質問に貼り付けてください。不安定なビデオで何かをすることは不可能です。 2.7.12にアップグレードすることを強くお勧めします。 –
@TerryJanReedy問題は、ENTERキーボードショートカットを使用して前のコードをコピーした場合にのみ表示されます。私が 'x5 = 4'と入力すると、動作します。だから私はIDLEが何かを台無しにしていると思う。私は質問にIDLEログ全体を出しました。 –
あなたの 'x5'の名前の1つに、目に見えない制御文字がありますか?時間のうちの1つの名前をコピーして貼り付けていて、他のものを貼り付けていない場合、これが問題を説明することができます。 – Blckknght