草庐IT

attribute2

全部标签

python - Matplotlib 属性错误 : 'module' object has no attribute 'popall'

当尝试使用pyplot绘制图形时,我正在运行以下代码:frommatplotlibimportpyplotaspltx=[6,5,4]y=[3,4,5]plt.plot(x,y)plt.show()这将返回以下错误:---------------------------------------------------------------------------AttributeErrorTraceback(mostrecentcalllast)in()4y=[3,4,5]5---->6plt.plot(x,y)7plt.show()/usr/local/lib/python2.7/

python - 类型错误 : '_sre.SRE_Match' object has no attribute '__getitem__'

我目前遇到此错误,但不知道是什么意思。这是一个scrapypython项目,这是我看到的错误:File"/bp_scraper/bp_scraper/httpmiddleware.py",line22,infrom_crawlerreturncls(crawler.settings)File"/bp_scraper/bp_scraper/httpmiddleware.py",line12,in__init__ifparts[1]:TypeError:'_sre.SRE_Match'objecthasnoattribute'__getitem__'代码:importreimportran

python - Arff 装载机 : AttributeError: 'dict' object has no attribute 'data'

我正在尝试使用liac-arff库将.arff文件加载到numpy数组中。(https://github.com/renatopp/liac-arff)这是我的代码。importarff,numpyasnpdataset=arff.load(open('mydataset.arff','rb'))data=np.array(dataset.data)执行时出现错误。ArffLoader.py",line8,indata=np.array(dataset.data)AttributeError:'dict'objecthasnoattribute'data'我见过类似的帖子,Smarts

python - 启动 celery worker throws "no attribute ' worker_state_db'"

当我尝试在Django应用程序中启动celeryworker时:celery-AmyAppworker-linfo我收到以下错误:File"/home/alexander/.pyenv/versions/3.5.1/envs/myApp/lib/python3.5/site-packages/celery/utils/collections.py",line134,in__getattr__type(self).__name__,k))AttributeError:'Settings'objecthasnoattribute'worker_state_db'如果你知道如何解决它,请写下

python - SQLalchemy 属性错误 : 'str' object has no attribute '_sa_instance_state'

我正在尝试使用SQLAlchemy+Python向我的数据库中添加一个项目,但一直出现错误。我的数据库_setup.py:classcompany(Base):__tablename__='company'compID=Column(Integer,primary_key=True)name=Column(String(80),nullable=False)classitem(Base):__tablename__='items'itemID=Column(Integer,primary_key=True)name=Column(String(80),nullable=False)ca

Python SQLAlchemy : AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema'

我尝试在我的项目中创建一个新的数据库,但是当我运行脚本时出现了这个错误,我有另一个使用类似定义的项目,它以前工作过,但现在出现了同样的错误。我使用的是Python2.7.8,SQLAlchemy模块的版本是0.9.8。顺便说一句,一个项目使用了Flask-SQLAlchemy,效果很好。我很困惑。回溯信息如下:Traceback(mostrecentcalllast):File"D:/Projects/OO-IM/db_create.py",line4,infrommodelsimportBaseFile"D:\Projects\OO-IM\models.py",line15,inCo

python - 导入 Pandas 会出现错误 AttributeError : module 'pandas' has no attribute 'core' in iPython Notebook

我正在通过AnacondaNavigator应用程序(版本1.1.0)运行iPython笔记本。当我想导入Pandas时,它给了我一个奇怪的错误。我以为Anaconda应用包含pandas包?---------------------------------------------------------------------------AttributeErrorTraceback(mostrecentcalllast)in()---->1importpandasaspd/Users/bertcarremans/anaconda/lib/python3.5/site-package

python - 属性错误 : 'module' object has no attribute 'setdefaultencoding'

我尝试安装xadmin(这是一个django的插件,用于将后台与twitter的Bootstrap一起使用)。但是当我运行我的项目时,我的PyCharm终端出现以下错误:File"C:\Python34\lib\site-packages\xadmin\sites.py",line10,insys.setdefaultencoding("utf-8")AttributeError:'module'objecthasnoattribute'setdefaultencoding'这是xadmin插件中sites.py源代码的摘录:importsysfromfunctoolsimportup

Python 属性错误 : 'module' object has no attribute 'DIST_L2'

我正在尝试在Python中使用cv2.distanceTransform()方法。运行以下代码行时出现错误:dist_transform=cv2.distanceTransform(opening,cv2.DIST_L2,5)运行此代码时出现以下错误:AttributeError:'module'objecthasnoattribute'DIST_L2'之前已经问过类似的问题,我知道当你导入“something”而你的python文件名为“something.py”时会出现这个问题。但是,我的python文件名为segment3.py。谁能帮我解决这个问题?我正在尝试使用分水岭算法进行

python - 属性错误 : 'Manager' object has no attribute 'get_by_natural_key' error in Django?

我正在使用Django'1.5c1'。我的settings.py中有这一行:AUTH_USER_MODEL='fileupload.galaxyuser'这是我的Galaxyuser模型:classGalaxyUser(models.Model):id=models.IntegerField(primary_key=True)create_time=models.DateTimeField(null=True,blank=True)update_time=models.DateTimeField(null=True,blank=True)email=models.CharField(m