我正在尝试运行此程序
import matplotlib.pyplot as plt
import numpy
plt.plot([1, 2, 3],[5, 7, 4])
plt.show()
Run Code Online (Sandbox Code Playgroud)
我收到一条错误消息:ImportError:没有名为pyplot的模块
我已经在Windows 8 64位上安装了matplotlib,使用来自bash的pip命令安装了Python 2.7,我也更新了它,结果收到了这条消息:
Aneta@AKZ-5K-Computer:~$ C:/Python27/Scripts/pip install --upgrade matplotlib
Requirement already up-to-date: matplotlib in c:\python27\lib\site-packages
Requirement already up-to-date: pyparsing>=1.5.6 in c:\python27\lib\site-packages\pyparsing-2.0.3-py2.7-win32.egg (from matplotlib)
Requirement already up-to-date: numpy>=1.6 in c:\python27\lib\site-packages (from matplotlib)
Requirement already up-to-date: pytz in c:\python27\lib\site-packages\pytz-2015.6-py2.7.egg (from matplotlib)
Requirement already up-to-date: python-dateutil in c:\python27\lib\site-packages\python_dateutil-2.4.2-py2.7.egg (from matplotlib)
Requirement already up-to-date: six>=1.4 in c:\python27\lib\site-packages\six-1.10.0-py2.7.egg (from matplotlib)
Run Code Online (Sandbox Code Playgroud)
当我尝试安装pyplot时,我得到了这个按摩:
Aneta@AKZ-5K-Computer:~$ C:/Python27/Scripts/pip install pyplot
Collecting pyplot
Could not find a …Run Code Online (Sandbox Code Playgroud) 我有这个简单的小程序,它不起作用.我希望程序不断询问用户我的名字,直到他们猜到.
第一次尝试后,程序将抛出错误消息.我无法解决问题所在.
name = "not_aneta"
while name != "aneta":
name = input("What is my name? ")
if name == "aneta":
print "You guessed my name!"
Run Code Online (Sandbox Code Playgroud)
当我运行它时,我收到一条错误消息:
Traceback (most recent call last):
File "C:\Users\Aneta\Desktop\guess_my_name.py", line 4, in <module>
name = input("What is my name? ")
File "<string>", line 1, in <module>
NameError: name 'aneta' is not defined
Run Code Online (Sandbox Code Playgroud)