gpt4 book ai didi

python - 导入错误: No module named class_vis

转载 作者:太空宇宙 更新时间:2023-11-03 14:10:32 28 4
gpt4 key购买 nike

我错过了这件事吗?我在网上搜索了有关安装软件包的信息,尤其是 PrettyPicture,但没有任何信息。这个已经不用了吗?

import numpy 
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
#from studentRegression import studentReg
from class_vis import prettyPicture, output_image

from ages_networths import ageNetWorthData

ages_train, ages_test, net_worths_train, net_worths_test = ageNetWorthData()

reg=studentReg(ages_train,net_worths_train)

plt.clf()
plt.scatter(ages_train,net_worths_train,color="b",label="train data")
plt.scatter(ages_test, net_worths_test, color='r', label="test data")
plt.plot(ages_test, reg.predict(ages_test), color="black")
plt.legent(loc=2)
plt.xlabel("ages")
plt.ylabel("net worths")

plt.savefig("test.png")
output_image("test.png", "png", open("test.png", "rb").read())

错误消息:

ImportError                               Traceback (most recent call last)
<ipython-input-10-7e6ab2d3ca3d> in <module>()
5 import matplotlib.pyplot as plt
6 #from studentRegression import studentReg
----> 7 from class_vis import prettyPicture, output_image
8
9 from ages_networths import ageNetWorthData

ImportError: No module named class_vis

最佳答案

class_vis.py 可用 here 。它来自:

ud120-项目

为参加 Udacity ud120 的学生提供的入门项目代码

关于python - 导入错误: No module named class_vis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48533399/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com