运行Python,解释器给出如下输出:<generator object <genexpr> at 0x000001B66C1799A8>,请问什么意思?

今天运行python,结果运行处不知道什么意思的代码,请问是什么?报错的话应该怎么修改。代码如下:

tuple1 = (1,2,4,8,16,32,64,128,256)
list1 = [i for i in tuple1]
print(i for i in list1)

输出结果是:
at 0x000001B66C1799A8>

4个回答

今天刚好我也遇到这个问题
按你的思路,最后的语句应该是:
print([i for i in list1])

你用的是列表解析。

tuple1 = (1, 2, 4, 8, 16, 32, 64, 128, 256)
print([i for i in tuple1])

(i for i in list1)生成了一个迭代器( python generator object)对象,类似C++中的指针和iterator对象.
([i for i in list1])就是生成列表

你试试print(list1),就能看到打印结果了。

列表生成式生成的列表被你改成了生成器
生成器的输出就是这样的
要想输出列表内元素,用print(next(i for i in list1))

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Python关于AES加密程序的运行出现error,有大神相助吗?
代码如下:(AES CBC模式加密) ``` # 导入图像处理标准库 from PIL import Image # 导入Cryptodome库,引用aes加密模块 from Cryptodome import AES import random import string # 随机生成16个由小写字母组成的字符串 def key_generator(size = 16, chars = string.ascii_lowercase): return ''.join(random.choice(chars) for _ in range(size)) #filename = "d:/blackhat.bmp" #filename_encrypted_cbc = "blackhat_encrypted_cbc" #formatt = "BMP" # 利用函数随机生成一个由小写字母组成的字符串 #key = key_generator(16) #print("key:"+key) # AES加密的明文空间为16的整数倍,不能整除,则需要进行填充 # 在对应的ascii中,"\x00"表示为0x00,具体的值为NULL,b表示以字节表示 def pad(data): return data + b"\x00" * (16 - len(data) % 16) # 将图像的数据映射为RGB def trans_format_rbg(data): # tuple:不可变,保证数据不丢失 red, green, blue = tuple(map(lambda e: [data[i] for i in range(0, len(data)) if i % 3 == e], [0, 1, 2])) pixels = tuple(zip(red, green, blue)) return pixels # CBC加密 def aes_cbc_encrypt(key1, data, mode=AES.MODE_CBC): # iv为随机值 iv = key_generator(16) aes = AES.new(key1, mode, iv) new_data = aes.encrypt(data) return new_data def encrypt_image_cbc(filename1): # 打开bmp图片,然后将之转换为RGB图像 im = Image.open(filename1) value_vector = im.convert("RGB").tobytes() # 将图像数据转换为像素值字节 imlength = len(value_vector) # 将填充、加密后的数据进行像素值映射 value_encrypt = trans_format_rbg(aes_cbc_encrypt(key, pad(value_vector))[:imlength]) # 创建一个新对象,存储相对应的值 im2 = Image.new(im.mode, im.size) im2.putdata(value_encrypt) # 将对象保存为对应格式的图像 im2.save(filename_encrypted_cbc + "." + formatt, format) # im2.save(filename_encrypted_cbc+".bmp") key = key_generator(16) filename = "d:/blackhat.bmp" filename_encrypted_cbc = "blackhat_encrypted_cbc" formatt = "BMP" encrypt_image_cbc(filename) im = Image.open(filename) im.show() ``` 运行后出现如下错误: Traceback (most recent call last): File "C:/Users/GYW/PycharmProjects/untitled/CBC encrypt", line 74, in <module> encrypt_image_cbc(filename) File "C:/Users/GYW/PycharmProjects/untitled/CBC encrypt", line 59, in encrypt_image_cbc value_encrypt = trans_format_rbg(aes_cbc_encrypt(key, pad(value_vector))[:imlength]) File "C:/Users/GYW/PycharmProjects/untitled/CBC encrypt", line 45, in aes_cbc_encrypt aes = AES.new(key1, mode, iv) File "C:\Users\GYW\PycharmProjects\untitled\venv\lib\site-packages\Cryptodome\AES.py", line 232, in new return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs) File "C:\Users\GYW\PycharmProjects\untitled\venv\lib\site-packages\Cryptodome\Cipher\__init__.py", line 79, in _create_cipher return modes[mode](factory, **kwargs) File "C:\Users\GYW\PycharmProjects\untitled\venv\lib\site-packages\Cryptodome\Cipher\_mode_cbc.py", line 274, in _create_cbc_cipher cipher_state = factory._create_base_cipher(kwargs) File "C:\Users\GYW\PycharmProjects\untitled\venv\lib\site-packages\Cryptodome\AES.py", line 103, in _create_base_cipher result = start_operation(c_uint8_ptr(key), File "C:\Users\GYW\PycharmProjects\untitled\venv\lib\site-packages\Cryptodome\Util\_raw_api.py", line 238, in c_uint8_ptr raise TypeError("Object type %s cannot be passed to C code" % type(data)) TypeError: Object type <class 'str'> cannot be passed to C code Process finished with exit code 1 刚接触python 求大神拉一把~
python生成器输出值?
``` >>> stack = [(v for u, v in G.edges('130'))] >>> stack [<generator object <genexpr> at 0x09E6F120>] >>> for i in stack: print i <generator object <genexpr> at 0x09E6F120> >>> type(stack) <type 'list'> >>> ``` 为什么不能输出stack里面的值,如何才能输出stack里面的值?
安装Tensorflow object detection API之后运行model_builder_test.py报错?
``` Traceback (most recent call last): File "G:\python\models\research\object_detection\builders\model_builder_test.py", line 23, in <module> from object_detection.builders import model_builder File "G:\python\models\research\object_detection\builders\model_builder.py", line 20, in <module> from object_detection.builders import anchor_generator_builder File "G:\python\models\research\object_detection\builders\anchor_generator_builder.py", line 22, in <module> from object_detection.protos import anchor_generator_pb2 File "G:\python\models\research\object_detection\protos\anchor_generator_pb2.py", line 29, in <module> dependencies=[object__detection_dot_protos_dot_flexible__grid__anchor__generator__pb2.DESCRIPTOR,object__detection_dot_protos_dot_grid__anchor__generator__pb2.DESCRIPTOR,object__detection_dot_protos_dot_multiscale__anchor__generator__pb2.DESCRIPTOR,object__detection_dot_protos_dot_ssd__anchor__generator__pb2.DESCRIPTOR,]) File "G:\python\python setup\lib\site-packages\google\protobuf\descriptor.py", line 879, in __new__ return _message.default_pool.AddSerializedFile(serialized_pb) TypeError: Couldn't build proto file into descriptor pool! Invalid proto descriptor for file "object_detection/protos/anchor_generator.proto": object_detection/protos/flexible_grid_anchor_generator.proto: Import "object_detection/protos/flexible_grid_anchor_generator.proto" has not been loaded. object_detection/protos/multiscale_anchor_generator.proto: Import "object_detection/protos/multiscale_anchor_generator.proto" has not been loaded. object_detection.protos.AnchorGenerator.multiscale_anchor_generator: "object_detection.protos.MultiscaleAnchorGenerator" seems to be defined in "protos/multiscale_anchor_generator.proto", which is not imported by "object_detection/protos/anchor_generator.proto". To use it here, please add the necessary import. object_detection.protos.AnchorGenerator.flexible_grid_anchor_generator: "object_detection.protos.FlexibleGridAnchorGenerator" seems to be defined in "protos/flexible_grid_anchor_generator.proto", which is not imported by "object_detection/protos/anchor_generator.proto". To use it here, please add the necessary import. ``` 网上找了各种方法都没用,有些可能有用的但是不够详细。
python tkinter里面,怎么把函数的结果按照函数原本的样式输出到text框上面?
``` import tkinter as tk import time root=tk.Tk() root.title("how to do ") root.geometry('500x600') tk.Label(root, text="显示", bg="green", font=("Arial", 12), width=5, height=1).place(x=20,y=30) def print(): EditText.insert('1.0',A()) def A(): for i in range(100): time.sleep(1) #间隔1秒输出 if i < 3: yield ("编号{},字符串A".format(i)) if 3<i and i<5: yield ("编号{},字符串B".format(i)) if i >5: yield ("编号{},字符串C".format(i)) break return EditText = tk.Text(root,width=30,height=10) #创建文本框 EditText.grid(row=2,column=3) btn_test=tk.Button(root, text="按钮", command =print,width=5, height=2) btn_test.place( x=300,y=200) root.mainloop() ``` 这样子运行的结果:在text上出现:Generator Object A at 0x000002898B746CF0 如果把函数的字符串取出来: str=A() result=list(str) 这样子虽然可以输出,但是时间间隔没了、原格式也变了 期望输出结果是这样的: ![图片说明](https://img-ask.csdn.net/upload/201907/05/1562315645_427691.png) 但是如果像图片那样输出,代码可以改成: ``` def A(): for i in range(100): if i < 3: yield ("编号{},字符串A".format(i)) if 3<i and i<5: yield ("编号{},字符串B".format(i)) if i >5: yield ("编号{},字符串C".format(i)) break return for i in A(): print(i) ``` 但这样子在tkinter上insert不了 请问各位大佬,有没有什么办法解决。
python运行结果为什么是十六进制的数值
def my_range(start, last, step): number = start while number < last: yield number number += step return number a= my_range(0, 7, 1) print(a) 报错:<generator object my_range at 0x00000000021EF150>
pyecharts模块使用遇到了问题——使用geo地理图表,抛出TypeError: cannot unpack non-iterable NoneType object的异常
![图片说明](https://img-ask.csdn.net/upload/201910/06/1570346918_249397.png) ![图片说明](https://img-ask.csdn.net/upload/201910/06/1570346961_352887.png) 为什么用list来作为地图的数据会报错,但是用generator就正常呢?官方文档的demo也是用list的 pyecharts官方文档 https://pyecharts.org/#/zh-cn/geography_charts?id=geo%ef%bc%9a%e5%9c%b0%e7%90%86%e5%9d%90%e6%a0%87%e7%b3%bb
Python报错'xxx' object has no attribute 'xxx'
小白刚刚接触Python,想使用Python做一个用户注册和登陆的界面,使用pyqt从ui文件转换成py文件,但在转换完成之后执行报错,求大神解答。 # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'sign.ui' # # Created: Sun Nov 13 17:09:05 2016 # by: PyQt4 UI code generator 4.11.3 # # WARNING! All changes made in this file will be lost! import sys from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(747, 564) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.label = QtGui.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(50, 30, 211, 61)) self.label.setStyleSheet(_fromUtf8("\n" "font: 75 22pt \"Microsoft YaHei UI\";")) self.label.setObjectName(_fromUtf8("label")) self.label_2 = QtGui.QLabel(self.centralwidget) self.label_2.setGeometry(QtCore.QRect(50, 120, 81, 18)) self.label_2.setStyleSheet(_fromUtf8("font: 9pt \"Microsoft YaHei UI\";")) self.label_2.setObjectName(_fromUtf8("label_2")) self.lineEdit = QtGui.QLineEdit(self.centralwidget) self.lineEdit.setGeometry(QtCore.QRect(50, 150, 331, 25)) self.lineEdit.setObjectName(_fromUtf8("lineEdit")) self.label_3 = QtGui.QLabel(self.centralwidget) self.label_3.setGeometry(QtCore.QRect(50, 200, 81, 18)) self.label_3.setStyleSheet(_fromUtf8("font: 9pt \"Microsoft YaHei UI\";")) self.label_3.setObjectName(_fromUtf8("label_3")) self.lineEdit_2 = QtGui.QLineEdit(self.centralwidget) self.lineEdit_2.setGeometry(QtCore.QRect(50, 230, 331, 25)) self.lineEdit_2.setObjectName(_fromUtf8("lineEdit_2")) self.label_4 = QtGui.QLabel(self.centralwidget) self.label_4.setGeometry(QtCore.QRect(50, 280, 81, 18)) self.label_4.setStyleSheet(_fromUtf8("font: 9pt \"Microsoft YaHei UI\";")) self.label_4.setObjectName(_fromUtf8("label_4")) self.lineEdit_3 = QtGui.QLineEdit(self.centralwidget) self.lineEdit_3.setGeometry(QtCore.QRect(50, 310, 331, 25)) self.lineEdit_3.setObjectName(_fromUtf8("lineEdit_3")) self.pushButton = QtGui.QPushButton(self.centralwidget) self.pushButton.setGeometry(QtCore.QRect(50, 380, 112, 34)) self.pushButton.setStyleSheet(_fromUtf8("font: 9pt \"Microsoft YaHei UI\";\n" "background-color: rgb(215, 215, 215);")) self.pushButton.setObjectName(_fromUtf8("pushButton")) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 747, 30)) self.menubar.setObjectName(_fromUtf8("menubar")) MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None)) self.label.setText(_translate("MainWindow", "欢迎注册", None)) self.label_2.setText(_translate("MainWindow", "名字", None)) self.label_3.setText(_translate("MainWindow", "密码", None)) self.label_4.setText(_translate("MainWindow", "重复密码", None)) self.pushButton.setText(_translate("MainWindow", "注册", None)) if __name__ == "__main__": app = QtGui.QApplication(sys.argv) Form = QtGui.QWidget() ui = Ui_MainWindow() ui.setupUi(Form) Form.show() sys.exit(app.exec_()) Traceback (most recent call last): File "D:/PyCharm 2016.2.3/example/Sign.py", line 88, in <module> ui.setupUi(Form) File "D:/PyCharm 2016.2.3/example/Sign.py", line 64, in setupUi MainWindow.setCentralWidget(self.centralwidget) AttributeError: 'QWidget' object has no attribute 'setCentralWidget'
为什么这段代码运行后显示:进程已结束,退出代码0,却没有我设计的窗口出现,求解决??
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'jinhang.ui' # # Created by: PyQt5 UI code generator 5.13.0 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 600) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(30, 40, 71, 31)) self.label.setObjectName("label") self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setGeometry(QtCore.QRect(30, 100, 91, 21)) self.label_2.setObjectName("label_2") self.label_3 = QtWidgets.QLabel(self.centralwidget) self.label_3.setGeometry(QtCore.QRect(30, 140, 61, 21)) self.label_3.setObjectName("label_3") self.label_4 = QtWidgets.QLabel(self.centralwidget) self.label_4.setGeometry(QtCore.QRect(180, 140, 61, 16)) self.label_4.setObjectName("label_4") self.label_5 = QtWidgets.QLabel(self.centralwidget) self.label_5.setGeometry(QtCore.QRect(30, 180, 51, 21)) self.label_5.setObjectName("label_5") self.label_6 = QtWidgets.QLabel(self.centralwidget) self.label_6.setGeometry(QtCore.QRect(30, 210, 71, 31)) self.label_6.setObjectName("label_6") self.label_7 = QtWidgets.QLabel(self.centralwidget) self.label_7.setGeometry(QtCore.QRect(190, 210, 71, 31)) self.label_7.setObjectName("label_7") self.label_8 = QtWidgets.QLabel(self.centralwidget) self.label_8.setGeometry(QtCore.QRect(30, 250, 71, 21)) self.label_8.setObjectName("label_8") self.pushButton = QtWidgets.QPushButton(self.centralwidget) self.pushButton.setGeometry(QtCore.QRect(80, 490, 75, 23)) self.pushButton.setObjectName("pushButton") self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) self.pushButton_2.setGeometry(QtCore.QRect(220, 490, 75, 23)) self.pushButton_2.setObjectName("pushButton_2") self.textEdit = QtWidgets.QTextEdit(self.centralwidget) self.textEdit.setGeometry(QtCore.QRect(100, 40, 71, 31)) self.textEdit.setObjectName("textEdit") self.textEdit_2 = QtWidgets.QTextEdit(self.centralwidget) self.textEdit_2.setGeometry(QtCore.QRect(180, 40, 71, 31)) self.textEdit_2.setObjectName("textEdit_2") self.textEdit_3 = QtWidgets.QTextEdit(self.centralwidget) self.textEdit_3.setGeometry(QtCore.QRect(260, 40, 71, 31)) self.textEdit_3.setObjectName("textEdit_3") self.textEdit_4 = QtWidgets.QTextEdit(self.centralwidget) self.textEdit_4.setGeometry(QtCore.QRect(90, 130, 71, 31)) self.textEdit_4.setObjectName("textEdit_4") self.textEdit_5 = QtWidgets.QTextEdit(self.centralwidget) self.textEdit_5.setGeometry(QtCore.QRect(240, 130, 71, 31)) self.textEdit_5.setObjectName("textEdit_5") self.textEdit_6 = QtWidgets.QTextEdit(self.centralwidget) self.textEdit_6.setGeometry(QtCore.QRect(100, 210, 71, 31)) self.textEdit_6.setObjectName("textEdit_6") self.textEdit_7 = QtWidgets.QTextEdit(self.centralwidget) self.textEdit_7.setGeometry(QtCore.QRect(260, 210, 71, 31)) self.textEdit_7.setObjectName("textEdit_7") self.plainTextEdit = QtWidgets.QPlainTextEdit(self.centralwidget) self.plainTextEdit.setGeometry(QtCore.QRect(380, 0, 351, 551)) self.plainTextEdit.setObjectName("plainTextEdit") self.plainTextEdit_2 = QtWidgets.QPlainTextEdit(self.centralwidget) self.plainTextEdit_2.setGeometry(QtCore.QRect(30, 270, 341, 211)) self.plainTextEdit_2.setObjectName("plainTextEdit_2") self.verticalScrollBar = QtWidgets.QScrollBar(self.centralwidget) self.verticalScrollBar.setGeometry(QtCore.QRect(710, 0, 16, 551)) self.verticalScrollBar.setOrientation(QtCore.Qt.Vertical) self.verticalScrollBar.setObjectName("verticalScrollBar") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 23)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.label.setText(_translate("MainWindow", "aa号:")) self.label_2.setText(_translate("MainWindow", "时间段:")) self.label_3.setText(_translate("MainWindow", "开始时间:")) self.label_4.setText(_translate("MainWindow", "结束时间:")) self.label_5.setText(_translate("MainWindow", "bb段:")) self.label_6.setText(_translate("MainWindow", "开始点:")) self.label_7.setText(_translate("MainWindow", "结束点:")) self.label_8.setText(_translate("MainWindow", "分析结果:")) self.pushButton.setText(_translate("MainWindow", "清 除")) self.pushButton_2.setText(_translate("MainWindow", "开始分析")) if __name__ == "MainWindow": import sys app = QtWidgets.QApplication(sys.argv) widget = QtWidgets.QWidget() ui = Ui_MainWindow() ui.setupUi(MainWindow) MainWindow.show() sys.exit(app.exec_())
python程序出现TypeError: 'NoneType'
最近想自学一下用python做UI,但是根据网上的教程,在.ui文件转换为.py后,无法调用自定义的函数ShowButton-click,请大大看一下 # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'test_login_form.ui' # # Created by: PyQt5 UI code generator 5.9 # # WARNING! All changes made in this file will be lost! import sys from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QApplication , QMainWindow from test_login import * class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 600) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.gridLayoutWidget.setGeometry(QtCore.QRect(140, 100, 491, 321)) self.gridLayoutWidget.setObjectName("gridLayoutWidget") self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.CloseButton = QtWidgets.QPushButton(self.gridLayoutWidget) self.CloseButton.setObjectName("CloseButton") self.verticalLayout.addWidget(self.CloseButton) self.ClearButton = QtWidgets.QPushButton(self.gridLayoutWidget) self.ClearButton.setObjectName("ClearButton") self.verticalLayout.addWidget(self.ClearButton) self.lineEdit = QtWidgets.QLineEdit(self.gridLayoutWidget) self.lineEdit.setObjectName("lineEdit") self.verticalLayout.addWidget(self.lineEdit) self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.ShowButton = QtWidgets.QPushButton(self.gridLayoutWidget) self.ShowButton.setObjectName("ShowButton") self.horizontalLayout.addWidget(self.ShowButton) self.ShowFormButton = QtWidgets.QPushButton(self.gridLayoutWidget) self.ShowFormButton.setObjectName("ShowFormButton") self.horizontalLayout.addWidget(self.ShowFormButton) self.gridLayout.addLayout(self.horizontalLayout, 0, 1, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 23)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) self.ClearButton.clicked.connect(self.lineEdit.clear) self.CloseButton.clicked.connect(MainWindow.close) self.ShowButton.clicked.connect(self.ShowButton_click()) self.ShowFormButton.clicked.connect(self.ShowFromButton_click()) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.CloseButton.setText(_translate("MainWindow", "Close")) self.ClearButton.setText(_translate("MainWindow", "ClearEdit")) self.ShowButton.setText(_translate("MainWindow", "这是一个用户登录界面")) self.ShowFormButton.setText(_translate("MainWindow", "登录")) def ShowButton_click(self): QtWidgets.QMessageBox.information(self.ShowButton, "标题", "这是第一个PyQt5 GUI程序") def ShowFromButton_click(slef): app = QApplication(sys.argv) loginWindow = QMainWindow() Ui_LoginWindow().setupUi(loginWindow) loginWindow.show() sys.exit(app.exec_()) if __name__ == '__main__': app = QApplication(sys.argv) mainWindow = QMainWindow() Ui_MainWindow().setupUi(mainWindow) mainWindow.show() sys.exit(app.exec_()) pass ------------------------------------------------------------------------------------ Connected to pydev debugger (build 172.4343.24) Traceback (most recent call last): File "D:\PyCham\PyCharm Community Edition 2017.2.4\helpers\pydev\pydevd.py", line 1599, in <module> globals = debugger.run(setup['file'], None, None, is_module) File "D:\PyCham\PyCharm Community Edition 2017.2.4\helpers\pydev\pydevd.py", line 1026, in run pydev_imports.execfile(file, globals, locals) # execute the script File "D:\PyCham\PyCharm Community Edition 2017.2.4\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "D:\Python36\Project\test_login_form.py", line 84, in <module> Ui_MainWindow().setupUi(mainWindow) File "D:\Python36\Project\test_login_form.py", line 59, in setupUi self.ShowButton.clicked.connect(self.ShowButton_click()) TypeError: argument 1 has unexpected type 'NoneType' Process finished with exit code 1
python 总是得到奇怪的返回值,本应是字符串,为什么成了迭代器
``` class Solution: def optimalDivision(self, nums): """ :type nums: List[int] :rtype: str """ _len=len(nums) nums=[str(nums[i] for i in range(_len))] if _len<=2: return '/'.join(nums) else: return '{}/({})'.format(nums[0],'/'.join(nums[1:])) ``` 以上代码运行以后,return 的结果是一个迭代器 <generator object Solution.optimalDivision.<locals>.<genexpr> at 0x7fd1b0227468>/() 为什么?
python pyqt5 怎样暂停和退出指定线程?
![图片说明](https://img-ask.csdn.net/upload/201810/05/1538742487_875554.png) 怎样在点击界面的按钮暂停 或 停止 来控制线程的暂停或停止 我写的代码如下,请大神们指导下添加什么方法来控制线程 ``` # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'test1.ui' # # Created by: PyQt5 UI code generator 5.11.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets import time import threading import sys import os class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(387, 288) self.listWidget = QtWidgets.QListWidget(Dialog) self.listWidget.setGeometry(QtCore.QRect(110, 30, 256, 192)) self.listWidget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) self.listWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) self.listWidget.setObjectName("listWidget") self.widget = QtWidgets.QWidget(Dialog) self.widget.setGeometry(QtCore.QRect(20, 40, 77, 83)) self.widget.setObjectName("widget") self.verticalLayout = QtWidgets.QVBoxLayout(self.widget) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.pushButton = QtWidgets.QPushButton(self.widget) self.pushButton.setObjectName("pushButton") self.verticalLayout.addWidget(self.pushButton) self.pushButton_2 = QtWidgets.QPushButton(self.widget) self.pushButton_2.setObjectName("pushButton_2") self.verticalLayout.addWidget(self.pushButton_2) self.pushButton_3 = QtWidgets.QPushButton(self.widget) self.pushButton_3.setObjectName("pushButton_3") self.verticalLayout.addWidget(self.pushButton_3) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog) def retranslateUi(self, Dialog): _translate = QtCore.QCoreApplication.translate Dialog.setWindowTitle(_translate("Dialog", "Dialog")) self.pushButton.setText(_translate("Dialog", "开始")) self.pushButton_2.setText(_translate("Dialog", "暂停")) self.pushButton_3.setText(_translate("Dialog", "停止")) class Dialog(QtWidgets.QDialog): def closeEvent(self, event): reply = QtWidgets.QMessageBox.question(self, '本程序', "是否要退出程序?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.No) if reply == QtWidgets.QMessageBox.Yes: event.accept() os._exit(0) else: event.ignore() class myThread(threading.Thread): def __init__(self, ui): threading.Thread.__init__(self) self.ui = ui self.counter = 0 def run(self): a = 0 while True: a+=1 print(a) self.ui.listWidget.addItem(str(a)) time.sleep(1) def main(): """ 主函数,用于运行程序 :return: None """ app = QtWidgets.QApplication(sys.argv) dialog = Dialog() # 注意修改为了自己重写的Dialog类 ui = Ui_Dialog() ui.setupUi(dialog) dialog.show() # 显示了自己重写的Dialog类 thread1 = myThread(ui) thread1.start() sys.exit(app.exec_()) if __name__ == '__main__': main() ```
在学习人脸识别运用keras的过程中出现了问题
本人在尝试学习"http://www.cnblogs.com/neo-T/p/6477378.html" 此博客提供的人脸识别代码 遇到了以下问题,不知该怎么解决 ``` WARNING:tensorflow:Variable *= will be deprecated. Use variable.assign_mul if you want assignment to the variable value or 'x = x * y' if you want a new python Tensor object. Epoch 1/10 Traceback (most recent call last): File "E:/python/python3.64/python代码练习/人脸识别/face_train_use_keras.py", line 189, in <module> model.train(dataset) File "E:/python/python3.64/python代码练习/人脸识别/face_train_use_keras.py", line 179, in train validation_data=(dataset.valid_images, dataset.valid_labels)) File "E:\python\anaconda\anaconda\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "E:\python\anaconda\anaconda\lib\site-packages\keras\models.py", line 1315, in fit_generator initial_epoch=initial_epoch) File "E:\python\anaconda\anaconda\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "E:\python\anaconda\anaconda\lib\site-packages\keras\engine\training.py", line 2268, in fit_generator callbacks.on_epoch_end(epoch, epoch_logs) File "E:\python\anaconda\anaconda\lib\site-packages\keras\callbacks.py", line 77, in on_epoch_end callback.on_epoch_end(epoch, logs) File "E:\python\anaconda\anaconda\lib\site-packages\keras\callbacks.py", line 339, in on_epoch_end self.progbar.update(self.seen, self.log_values) AttributeError: 'ProgbarLogger' object has no attribute 'log_values' ``` 我清楚ProgbarLogger内没有log_values的属性的意思,但是因为刚开始接触,不知道应怎样改动
TypeError: 'FileWriter' object is not callable
import tensorflow as tf import tensorlayer as tl import numpy as np class CNNEnv: def __init__(self): # The data, shuffled and split between train and test sets self.x_train, self.y_train, self.x_test, self.y_test = tl.files.load_cifar10_dataset(shape=(-1, 32, 32, 3), plotable=False) # Reorder dimensions for tensorflow self.mean = np.mean(self.x_train, axis=0, keepdims=True) self.std = np.std(self.x_train) self.x_train = (self.x_train - self.mean) / self.std self.x_test = (self.x_test - self.mean) / self.std print('x_train shape:', self.x_train.shape) print('x_test shape:', self.x_test.shape) print('y_train shape:', self.y_train.shape) print('y_test shape:', self.y_test.shape) # For generator self.num_examples = self.x_train.shape[0] self.index_in_epoch = 0 self.epochs_completed = 0 # For wide resnets self.blocks_per_group = 4 self.widening_factor = 4 # Basic info self.batch_num = 64 self.img_row = 32 self.img_col = 32 self.img_channels = 3 self.nb_classes = 10 def next_batch(self, batch_size): """Return the next `batch_size` examples from this data set.""" self.batch_size = batch_size start = self.index_in_epoch self.index_in_epoch += self.batch_size if self.index_in_epoch > self.num_examples: # Finished epoch self.epochs_completed += 1 # Shuffle the data perm = np.arange(self.num_examples) np.random.shuffle(perm) self.x_train = self.x_train[perm] self.y_train = self.y_train[perm] # Start next epoch start = 0 self.index_in_epoch = self.batch_size assert self.batch_size <= self.num_examples end = self.index_in_epoch return self.x_train[start:end], self.y_train[start:end] def reset(self, first): self.first = first if self.first is True: self.sess.close() config = tf.ConfigProto() config.gpu_options.allow_growth = True self.sess = tf.InteractiveSession(config=config) def step(self): def zero_pad_channels(x, pad=0): """ Function for Lambda layer """ pattern = [[0, 0], [0, 0], [0, 0], [pad - pad // 2, pad // 2]] return tf.pad(x, pattern) def residual_block(x, count, nb_filters=16, subsample_factor=1): prev_nb_channels = x.outputs.get_shape().as_list()[3] if subsample_factor > 1: subsample = [1, subsample_factor, subsample_factor, 1] # shortcut: subsample + zero-pad channel dim name_pool = 'pool_layer' + str(count) shortcut = tl.layers.PoolLayer(x, ksize=subsample, strides=subsample, padding='VALID', pool=tf.nn.avg_pool, name=name_pool) else: subsample = [1, 1, 1, 1] # shortcut: identity shortcut = x if nb_filters > prev_nb_channels: name_lambda = 'lambda_layer' + str(count) shortcut = tl.layers.LambdaLayer( shortcut, zero_pad_channels, fn_args={'pad': nb_filters - prev_nb_channels}, name=name_lambda) name_norm = 'norm' + str(count) y = tl.layers.BatchNormLayer(x, decay=0.999, epsilon=1e-05, is_train=True, name=name_norm) name_conv = 'conv_layer' + str(count) y = tl.layers.Conv2dLayer(y, act=tf.nn.relu, shape=[3, 3, prev_nb_channels, nb_filters], strides=subsample, padding='SAME', name=name_conv) name_norm_2 = 'norm_second' + str(count) y = tl.layers.BatchNormLayer(y, decay=0.999, epsilon=1e-05, is_train=True, name=name_norm_2) prev_input_channels = y.outputs.get_shape().as_list()[3] name_conv_2 = 'conv_layer_second' + str(count) y = tl.layers.Conv2dLayer(y, act=tf.nn.relu, shape=[3, 3, prev_input_channels, nb_filters], strides=[1, 1, 1, 1], padding='SAME', name=name_conv_2) name_merge = 'merge' + str(count) out = tl.layers.ElementwiseLayer([y, shortcut], combine_fn=tf.add, name=name_merge) return out # Placeholders learning_rate = tf.placeholder(tf.float32) img = tf.placeholder(tf.float32, shape=[self.batch_num, 32, 32, 3]) labels = tf.placeholder(tf.int32, shape=[self.batch_num, ]) x = tl.layers.InputLayer(img, name='input_layer') x = tl.layers.Conv2dLayer(x, act=tf.nn.relu, shape=[3, 3, 3, 16], strides=[1, 1, 1, 1], padding='SAME', name='cnn_layer_first') for i in range(0, self.blocks_per_group): nb_filters = 16 * self.widening_factor count = i x = residual_block(x, count, nb_filters=nb_filters, subsample_factor=1) for i in range(0, self.blocks_per_group): nb_filters = 32 * self.widening_factor if i == 0: subsample_factor = 2 else: subsample_factor = 1 count = i + self.blocks_per_group x = residual_block(x, count, nb_filters=nb_filters, subsample_factor=subsample_factor) for i in range(0, self.blocks_per_group): nb_filters = 64 * self.widening_factor if i == 0: subsample_factor = 2 else: subsample_factor = 1 count = i + 2*self.blocks_per_group x = residual_block(x, count, nb_filters=nb_filters, subsample_factor=subsample_factor) x = tl.layers.BatchNormLayer(x, decay=0.999, epsilon=1e-05, is_train=True, name='norm_last') x = tl.layers.PoolLayer(x, ksize=[1, 8, 8, 1], strides=[1, 8, 8, 1], padding='VALID', pool=tf.nn.avg_pool, name='pool_last') x = tl.layers.FlattenLayer(x, name='flatten') x = tl.layers.DenseLayer(x, n_units=self.nb_classes, act=tf.identity, name='fc') output = x.outputs ce = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(output, labels)) cost = ce tf.summary.histogram('cost',cost) correct_prediction = tf.equal(tf.cast(tf.argmax(output, 1), tf.int32), labels) acc = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) tf.summary.histogram('acc',acc) train_params = x.all_params train_op = tf.train.GradientDescentOptimizer( learning_rate, use_locking=False).minimize(cost, var_list=train_params) merged = tf.summary.merge_all() writer1 = tf.summary.FileWriter('train/',self.sess.graph) #先执行 self.sess.run(tf.global_variables_initializer()) tf.global_variables_initializer() for i in range(10): batch = self.next_batch(self.batch_num) feed_dict = {img: batch[0], labels: batch[1], learning_rate: 0.01} feed_dict.update(x.all_drop) tp, l, ac,me1 = self.sess.run([train_op, cost, acc,merged], feed_dict=feed_dict) writer1(me1,i) print('loss', l) print('acc', ac) writer1.close() a = CNNEnv() a.reset(first=False) a.step()
ninja 和 VS2015编译caffe-windows失败
![失败截图](https://img-ask.csdn.net/upload/201807/15/1531650930_543226.png) 失败提示 Determining if the C compiler works failed with the following output: Change Dir: G:/Git/caffe/scripts/build/CMakeFiles/CMakeTmp Run Build Command:"C:/Users/TAO/Anaconda3/Library/bin/ninja.exe" "cmTC_55e72" [1/2] Building C object CMakeFiles\cmTC_55e72.dir\testCCompiler.c.obj [2/2] Linking C executable cmTC_55e72.exe FAILED: cmTC_55e72.exe cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_55e72.dir --manifests -- C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\link.exe /nologo CMakeFiles\cmTC_55e72.dir\testCCompiler.c.obj /out:cmTC_55e72.exe /implib:cmTC_55e72.lib /pdb:cmTC_55e72.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ." RC Pass 1: command "rc /foCMakeFiles\cmTC_55e72.dir/manifest.res CMakeFiles\cmTC_55e72.dir/manifest.rc" failed (exit code 0) with the following output: The system cannot find the file specified ninja: build stopped: subcommand failed. 我的脚本是 :: Change the settings here to match your setup :: Change MSVC_VERSION to 12 to use VS 2013 if NOT DEFINED MSVC_VERSION set MSVC_VERSION=14 :: Change to 1 to use Ninja generator (builds much faster) if NOT DEFINED WITH_NINJA set WITH_NINJA=1 :: Change to 1 to build caffe without CUDA support if NOT DEFINED CPU_ONLY set CPU_ONLY=0 :: Change to generate CUDA code for one of the following GPU architectures :: [Fermi Kepler Maxwell Pascal All] if NOT DEFINED CUDA_ARCH_NAME set CUDA_ARCH_NAME=Auto :: Change to Debug to build Debug. This is only relevant for the Ninja generator the Visual Studio generator will generate both Debug and Release configs if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG=Release :: Set to 1 to use NCCL if NOT DEFINED USE_NCCL set USE_NCCL=0 :: Change to 1 to build a caffe.dll if NOT DEFINED CMAKE_BUILD_SHARED_LIBS set CMAKE_BUILD_SHARED_LIBS=0 :: Change to 3 if using python 3.5 (only 2.7 and 3.5 are supported) if NOT DEFINED PYTHON_VERSION set PYTHON_VERSION=3 :: Change these options for your needs. if NOT DEFINED BUILD_PYTHON set BUILD_PYTHON=1 if NOT DEFINED BUILD_PYTHON_LAYER set BUILD_PYTHON_LAYER=1 if NOT DEFINED BUILD_MATLAB set BUILD_MATLAB=0 :: If python is on your path leave this alone if NOT DEFINED PYTHON_EXE set PYTHON_EXE=python :: Run the tests if NOT DEFINED RUN_TESTS set RUN_TESTS=0 :: Run lint if NOT DEFINED RUN_LINT set RUN_LINT=0 :: Build the install target if NOT DEFINED RUN_INSTALL set RUN_INSTALL=0 折腾一个星期也没弄出来,请大神帮忙看下,谢谢
scrapy-redis报错,这个真不知道什么原因,我之前写的另外一个爬虫是可以执行的
Traceback (most recent call last): File "C:\Users\xin\Desktop\spider_thief\venv\lib\site-packages\scrapy\utils\defer.py", line 102, in iter_errback yield next(it) GeneratorExit Exception ignored in: <generator object iter_errback at 0x0000029D30248CA8> RuntimeError: generator ignored GeneratorExit Unhandled error in Deferred: 2018-07-17 17:50:00 [twisted] CRITICAL: Unhandled error in Deferred: 2018-07-17 17:50:00 [twisted] CRITICAL: Traceback (most recent call last): File "C:\Users\xin\Desktop\spider_thief\venv\lib\site-packages\twisted\internet\task.py", line 517, in _oneWorkUnit result = next(self._iterator) File "C:\Users\xin\Desktop\spider_thief\venv\lib\site-packages\scrapy\utils\defer.py", line 63, in <genexpr> work = (callable(elem, *args, **named) for elem in iterable) File "C:\Users\xin\Desktop\spider_thief\venv\lib\site-packages\scrapy\core\scraper.py", line 183, in _process_spidermw_output self.crawler.engine.crawl(request=output, spider=spider) File "C:\Users\xin\Desktop\spider_thief\venv\lib\site-packages\scrapy\core\engine.py", line 210, in crawl self.schedule(request, spider) File "C:\Users\xin\Desktop\spider_thief\venv\lib\site-packages\scrapy\core\engine.py", line 216, in schedule if not self.slot.scheduler.enqueue_request(request): File "C:\Users\xin\Desktop\spider_thief\venv\lib\site-packages\scrapy_redis\scheduler.py", line 167, in enqueue_request self.queue.push(request) File "C:\Users\xin\Desktop\spider_thief\venv\lib\site-packages\scrapy_redis\queue.py", line 99, in push data = self._encode_request(request) File "C:\Users\xin\Desktop\spider_thief\venv\lib\site-packages\scrapy_redis\queue.py", line 43, in _encode_request return self.serializer.dumps(obj) File "C:\Users\xin\Desktop\spider_thief\venv\lib\site-packages\scrapy_redis\picklecompat.py", line 14, in dumps return pickle.dumps(obj, protocol=-1) RecursionError: maximum recursion depth exceeded while calling a Python object
qtdesigner设置的Ui界面与python打开不一致
这是我的Ui界面![图片说明](https://img-ask.csdn.net/upload/201906/09/1560085491_704266.png) 这是实际的界面![图片说明]![图片说明](https://img-ask.csdn.net/upload/201906/09/1560085520_226184.png) 不知道为什么大小位置完全不一样 python新手 希望大佬们指教 ``` # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'tt.ui' # # Created by: PyQt5 UI code generator 5.11.3 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 600) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.widget_video = QtWidgets.QWidget(self.centralwidget) self.widget_video.setGeometry(QtCore.QRect(140, 100, 511, 311)) self.widget_video.setObjectName("widget_video") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) ``` 以上是Ui界面 ``` from PyQt5.QtWidgets import * from PyQt5.QtMultimedia import * from PyQt5.QtMultimediaWidgets import QVideoWidget from PyQt5.QtCore import QUrl from tt import Ui_MainWindow import sys class myMainWindow(Ui_MainWindow,QMainWindow): def __init__(self): super(Ui_MainWindow, self).__init__() self.setupUi(self) self.player = QMediaPlayer(self) self.widget_video = QVideoWidget(self) self.player.setVideoOutput(self.widget_video) self.player.setMedia(QMediaContent(QUrl.fromLocalFile("cat.avi"))) # local source self.player.play() # 播放视频 if __name__ == '__main__': app = QApplication(sys.argv) video_gui = myMainWindow() video_gui.show() sys.exit(app.exec_()) ``` 以上是主程序界面
请问这个pyqt界面转化为python程序的问题?
用pyqt界面设计转化为python代码 加入了slot响应函数 但是编译不过,编译问题在后面 这是怎么回事 # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'form111.ui' # # Created: Tue May 16 21:26:25 2017 # by: PyQt4 UI code generator 4.11.2 # # WARNING! All changes made in this file will be lost! import sys from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) class Ui_Form(object): def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(400, 300) self.pushButton = QtGui.QPushButton(Form) self.pushButton.setGeometry(QtCore.QRect(130, 30, 75, 23)) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.textEdit = QtGui.QTextEdit(Form) self.textEdit.setGeometry(QtCore.QRect(40, 80, 281, 171)) self.textEdit.setObjectName(_fromUtf8("textEdit")) self.retranslateUi(Form) QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("clicked()")), Form.slot1) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): Form.setWindowTitle(_translate("Form", "Form", None)) self.pushButton.setText(_translate("Form", "Hello World", None)) def slot1(self): self.textEdit.setText('nihao') if __name__ == '__main__': app = QtGui.QApplication (sys.argv) Form=QtGui.QWidget () ui=Ui_Form() ui.setupUi (Form) Form.show() 编译出现问题 Traceback (most recent call last): File "D:\qttest\form222.py", line 56, in <module> ui.setupUi (Form) File "D:\qttest\form222.py", line 38, in setupUi QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("clicked()")), Form.slot1) AttributeError: 'QWidget' object has no attribute 'slot1'
为什么点击按钮后直接关闭窗口了,没有弹出对话框呢?
**为什么点击按钮后直接关闭窗口了,没有弹出对话框呢?** ``` # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'frmMain.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! import sys from PyQt5.QtWidgets import QApplication , QMainWindow from PyQt5 import QtCore, QtGui, QtWidgets class Ui_frmMain(object): def setupUi(self, frmMain): frmMain.setObjectName("frmMain") frmMain.resize(415, 265) self.centralwidget = QtWidgets.QWidget(frmMain) self.centralwidget.setObjectName("centralwidget") self.btnFirst = QtWidgets.QPushButton(self.centralwidget) self.btnFirst.setGeometry(QtCore.QRect(150, 70, 75, 23)) self.btnFirst.setObjectName("btnFirst") frmMain.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(frmMain) self.menubar.setGeometry(QtCore.QRect(0, 0, 415, 23)) self.menubar.setObjectName("menubar") frmMain.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(frmMain) self.statusbar.setObjectName("statusbar") frmMain.setStatusBar(self.statusbar) self.retranslateUi(frmMain) self.btnFirst.clicked.connect(self.btnFirstClike) QtCore.QMetaObject.connectSlotsByName(frmMain) def retranslateUi(self, frmMain): _translate = QtCore.QCoreApplication.translate frmMain.setWindowTitle(_translate("frmMain", "我的第一个窗口")) self.btnFirst.setText(_translate("frmMain", "第一个按钮")) def btnFirstClike(self): QtWidgets.QMessageBox.about(self,"测试","点击弹出窗口成功") if __name__ == '__main__': ''' 主函数 ''' app = QApplication(sys.argv) mainWindow = QMainWindow() ui = Ui_frmMain() ui.setupUi(mainWindow) mainWindow.show() sys.exit(app.exec_()) ```
caffe生成解决方案时出错
编译环境:win10 vs2017 15.5.6 boost_1_70_0 主要报错: Unknown compiler version - please run the configure tests and report the results 再次点生成解决方案时的主要报错: for each 语句不能在“std::array *”类型的变量上操作 ; “std::array”: 模板 参数太少 ; 无法打开文件“libboost_date_time-vc140-mt-gd-1_59.lib” 等等; 因为只能一条条复制,所以如有需要,可提供详细错误; 下面是重新生成解决方案的具体报错,有大佬来救救我吗,感激不尽!需要更详细信息可以直说。 报错:1>------ 已启动全部重新生成: 项目: libcaffe, 配置: Debug x64 ------ 1>ProtoCompile.cmd : Create proto temp directory "C:\Users\Kay Chow\Documents\caffe-master\windows\..\src\caffe\proto\temp" 1>ProtoCompile.cmd : Generating "C:\Users\Kay Chow\Documents\caffe-master\windows\..\src\caffe\proto\temp\caffe.pb.h" and "C:\Users\Kay Chow\Documents\caffe-master\windows\..\src\caffe\proto\temp\caffe.pb.cc" 1>ProtoCompile.cmd : Create proto include directory 1>子目录或文件 C:\Users\Kay Chow\Documents\caffe-master\windows\..\include\caffe\proto 已经存在。 1>ProtoCompile.cmd : Compare newly compiled caffe.pb.h with existing one 1>blob.cpp 1>common.cpp 1>data_reader.cpp 1>data_transformer.cpp 1>internal_thread.cpp 1>layer.cpp 1>absval_layer.cpp 1>accuracy_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>argmax_layer.cpp 1>base_conv_layer.cpp 1>base_data_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>batch_norm_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>batch_reindex_layer.cpp 1>bias_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>bnll_layer.cpp 1>box_annotator_ohem_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>concat_layer.cpp 1>contrastive_loss_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>conv_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>crop_layer.cpp 1>cudnn_conv_layer.cpp 1>cudnn_lcn_layer.cpp 1>cudnn_lrn_layer.cpp 1>cudnn_pooling_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>cudnn_relu_layer.cpp 1>cudnn_sigmoid_layer.cpp 1>cudnn_softmax_layer.cpp 1>cudnn_tanh_layer.cpp 1>data_layer.cpp 1>deconv_layer.cpp 1>dropout_layer.cpp 1>dummy_data_layer.cpp 1>eltwise_layer.cpp 1>elu_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>embed_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>euclidean_loss_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>exp_layer.cpp 1>filter_layer.cpp 1>flatten_layer.cpp 1>hdf5_data_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>hdf5_output_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>hinge_loss_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>im2col_layer.cpp 1>image_data_layer.cpp 1>infogain_loss_layer.cpp 1>inner_product_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>input_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>log_layer.cpp 1>loss_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>lrn_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>memory_data_layer.cpp 1>multinomial_logistic_loss_layer.cpp 1>mvn_layer.cpp 1>neuron_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>parameter_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>pooling_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>power_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>prelu_layer.cpp 1>psroi_pooling_layer.cpp 1>reduction_layer.cpp 1>relu_layer.cpp 1>reshape_layer.cpp 1>scale_layer.cpp 1>sigmoid_cross_entropy_loss_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>sigmoid_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>silence_layer.cpp 1>slice_layer.cpp 1>smooth_l1_loss_layer.cpp 1>smooth_L1_loss_ohem_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>softmax_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>softmax_loss_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>softmax_loss_ohem_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>split_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>spp_layer.cpp 1>tanh_layer.cpp 1>threshold_layer.cpp 1>tile_layer.cpp 1>window_data_layer.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>layer_factory.cpp 1>net.cpp 1>parallel.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>caffe.pb.cc 1>solver.cpp 1>adadelta_solver.cpp 1>adagrad_solver.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>adam_solver.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>nesterov_solver.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>rmsprop_solver.cpp 1>sgd_solver.cpp 1>syncedmem.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>benchmark.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>blocking_queue.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>cudnn.cpp 1>db.cpp 1>db_leveldb.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>db_lmdb.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>hdf5.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>im2col.cpp 1>insert_splits.cpp 1>io.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>math_functions.cpp 1>signal_handler.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>upgrade_proto.cpp 1>Unknown compiler version - please run the configure tests and report the results 1>Unknown compiler version - please run the configure tests and report the results 1>libcaffe.vcxproj -> C:\Users\Kay Chow\Documents\caffe-master\windows\..\Build\x64\Debug\libcaffe.lib 1>BinplaceCudaDependencies : CPU only build, don't copy cuda dependencies. 2>------ 已启动全部重新生成: 项目: caffe, 配置: Debug x64 ------ 3>------ 已启动全部重新生成: 项目: caffe.managed, 配置: Debug x64 ------ 4>------ 已启动全部重新生成: 项目: convert_cifar_data, 配置: Debug x64 ------ 5>------ 已启动全部重新生成: 项目: classification, 配置: Debug x64 ------ 6>------ 已启动全部重新生成: 项目: convert_mnist_data, 配置: Debug x64 ------ 7>------ 已启动全部重新生成: 项目: convert_mnist_siamese_data, 配置: Debug x64 ------ 8>------ 已启动全部重新生成: 项目: upgrade_net_proto_binary, 配置: Debug x64 ------ 9>------ 已启动全部重新生成: 项目: upgrade_net_proto_text, 配置: Debug x64 ------ 2>caffe.cpp 9>upgrade_net_proto_text.cpp 2>Unknown compiler version - please run the configure tests and report the results 4>convert_cifar_data.cpp 3>Stdafx.cpp 9>Unknown compiler version - please run the configure tests and report the results 5>classification.cpp 6>convert_mnist_data.cpp 7>convert_mnist_siamese_data.cpp 4>Unknown compiler version - please run the configure tests and report the results 5>Unknown compiler version - please run the configure tests and report the results 8>upgrade_net_proto_binary.cpp 6>Unknown compiler version - please run the configure tests and report the results 8>Unknown compiler version - please run the configure tests and report the results 7>Unknown compiler version - please run the configure tests and report the results 3>AssemblyInfo.cpp 3>caffelib.cpp 3>caffelib.cpp(61): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(62): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(62): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(68): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(68): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(68): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(69): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(69): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(127): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(128): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(128): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(136): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(136): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(136): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(137): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(137): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(64): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(64): error C2027: 使用了未定义类型“std::array” 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(64): error C3536: “outputs”: 初始化之前无法使用 3>caffelib.cpp(64): error C2109: 下标要求数组或指针类型 3>caffelib.cpp(65): error C2440: “return”: 无法从“int”转换为“std::array *” 3>caffelib.cpp(65): note: 从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换 3>caffelib.cpp(71): error C3285: for each 语句不能在“std::array *”类型的变量上操作 3>caffelib.cpp(72): error C2065: “name”: 未声明的标识符 3>caffelib.cpp(74): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(74): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(74): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(74): error C2027: 使用了未定义类型“std::array” 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(78): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(78): error C2027: 使用了未定义类型“std::array” 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(78): error C3536: “values”: 初始化之前无法使用 3>caffelib.cpp(78): error C2109: 下标要求数组或指针类型 3>caffelib.cpp(79): error C3536: “outputs”: 初始化之前无法使用 3>caffelib.cpp(79): error C2109: 下标要求数组或指针类型 3>caffelib.cpp(81): error C2440: “return”: 无法从“int”转换为“std::array *” 3>caffelib.cpp(81): note: 从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换 3>caffelib.cpp(132): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(132): error C2027: 使用了未定义类型“std::array” 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(132): error C3536: “outputs”: 初始化之前无法使用 3>caffelib.cpp(132): error C2109: 下标要求数组或指针类型 3>caffelib.cpp(133): error C2440: “return”: 无法从“int”转换为“std::array *” 3>caffelib.cpp(133): note: 从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换 3>caffelib.cpp(141): error C3285: for each 语句不能在“std::array *”类型的变量上操作 3>caffelib.cpp(142): error C2065: “name”: 未声明的标识符 3>caffelib.cpp(144): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(144): error C3699: “^”: 不能在类型“std::array”上使用此间接寻址 3>caffelib.cpp(144): note: 编译器将“^”替换为“*”以继续进行分析 3>caffelib.cpp(144): error C2027: 使用了未定义类型“std::array” 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(148): error C2976: “std::array”: 模板 参数太少 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(148): error C2027: 使用了未定义类型“std::array” 3>D:\VS2017\VC\Tools\MSVC\14.12.25827\include\utility(474): note: 参见“std::array”的声明 3>caffelib.cpp(148): error C3536: “values”: 初始化之前无法使用 3>caffelib.cpp(148): error C2109: 下标要求数组或指针类型 3>caffelib.cpp(149): error C3536: “outputs”: 初始化之前无法使用 3>caffelib.cpp(149): error C2109: 下标要求数组或指针类型 3>caffelib.cpp(151): error C2440: “return”: 无法从“int”转换为“std::array *” 3>caffelib.cpp(151): note: 从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换 3>已完成生成项目“caffe.managed.vcxproj”的操作 - 失败。 4>LINK : fatal error LNK1104: 无法打开文件“libboost_thread-vc140-mt-gd-1_59.lib” 10>------ 已启动全部重新生成: 项目: upgrade_solver_proto_text, 配置: Debug x64 ------ 4>已完成生成项目“convert_cifar_data.vcxproj”的操作 - 失败。 6>LINK : fatal error LNK1104: 无法打开文件“libboost_thread-vc140-mt-gd-1_59.lib” 6>已完成生成项目“convert_mnist_data.vcxproj”的操作 - 失败。 10>upgrade_solver_proto_text.cpp 7>LINK : fatal error LNK1104: 无法打开文件“libboost_thread-vc140-mt-gd-1_59.lib” 7>已完成生成项目“convert_mnist_siamese_data.vcxproj”的操作 - 失败。 10>Unknown compiler version - please run the configure tests and report the results 9>LINK : fatal error LNK1104: 无法打开文件“libboost_date_time-vc140-mt-gd-1_59.lib” 9>已完成生成项目“upgrade_net_proto_text.vcxproj”的操作 - 失败。 8>LINK : fatal error LNK1104: 无法打开文件“libboost_date_time-vc140-mt-gd-1_59.lib” 8>已完成生成项目“upgrade_net_proto_binary.vcxproj”的操作 - 失败。 5>LINK : fatal error LNK1104: 无法打开文件“libboost_date_time-vc140-mt-gd-1_59.lib” 5>已完成生成项目“classification.vcxproj”的操作 - 失败。 2>LINK : fatal error LNK1104: 无法打开文件“libboost_date_time-vc140-mt-gd-1_59.lib” 2>已完成生成项目“caffe.vcxproj”的操作 - 失败。 11>------ 已启动全部重新生成: 项目: compute_image_mean, 配置: Debug x64 ------ 12>------ 已启动全部重新生成: 项目: convert_imageset, 配置: Debug x64 ------ 13>------ 已启动全部重新生成: 项目: extract_features, 配置: Debug x64 ------ 14>------ 已启动全部重新生成: 项目: test_all, 配置: Debug x64 ------ 15>------ 已启动全部重新生成: 项目: pycaffe, 配置: Debug x64 ------ 16>------ 已启动全部重新生成: 项目: matcaffe, 配置: Debug x64 ------ 15>Skipping project pycaffe, Python support is not enabled in CommonSettings.props. 16>Skipping project matcaffe, Matlab support is not enabled in CommonSettings.props. 12>convert_imageset.cpp 11>compute_image_mean.cpp 13>extract_features.cpp 14>test_accuracy_layer.cpp 14>test_argmax_layer.cpp 14>test_batch_norm_layer.cpp 14>test_batch_reindex_layer.cpp 14>test_benchmark.cpp 14>test_bias_layer.cpp 14>test_blob.cpp 14>test_caffe_main.cpp 14>Unknown compiler version - please run the configure tests and report the results 13>Unknown compiler version - please run the configure tests and report the results 12>Unknown compiler version - please run the configure tests and report the results 11>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 10>LINK : fatal error LNK1104: 无法打开文件“libboost_date_time-vc140-mt-gd-1_59.lib” 10>已完成生成项目“upgrade_solver_proto_text.vcxproj”的操作 - 失败。 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 11>LINK : fatal error LNK1104: 无法打开文件“libboost_filesystem-vc140-mt-gd-1_59.lib” 11>已完成生成项目“compute_image_mean.vcxproj”的操作 - 失败。 12>LINK : fatal error LNK1104: 无法打开文件“libboost_filesystem-vc140-mt-gd-1_59.lib” 12>已完成生成项目“convert_imageset.vcxproj”的操作 - 失败。 13>LINK : fatal error LNK1104: 无法打开文件“libboost_filesystem-vc140-mt-gd-1_59.lib” 13>已完成生成项目“extract_features.vcxproj”的操作 - 失败。 14>test_common.cpp 14>test_concat_layer.cpp 14>test_contrastive_loss_layer.cpp 14>test_convolution_layer.cpp 14>test_crop_layer.cpp 14>test_data_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_data_transformer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_db.cpp 14>test_deconvolution_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_dummy_data_layer.cpp 14>test_eltwise_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_embed_layer.cpp 14>test_euclidean_loss_layer.cpp 14>test_filler.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_filter_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_flatten_layer.cpp 14>test_gradient_based_solver.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_hdf5data_layer.cpp 14>test_hdf5_output_layer.cpp 14>test_hinge_loss_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_im2col_layer.cpp 14>test_image_data_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_infogain_loss_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_inner_product_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_internal_thread.cpp 14>test_io.cpp 14>test_layer_factory.cpp 14>test_lrn_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_math_functions.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_maxpool_dropout_layers.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_memory_data_layer.cpp 14>test_multinomial_logistic_loss_layer.cpp 14>test_mvn_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_net.cpp 14>test_neuron_layer.cpp 14>test_platform.cpp 14>test_pooling_layer.cpp 14>test_power_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_protobuf.cpp 14>test_random_number_generator.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_reduction_layer.cpp 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(1010): error C2220: 警告被视为错误 - 没有生成“object”文件 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(992): note: 编译 类 模板 成员函数 "void caffe::NetTest_TestLossWeightMidNet_Test<T>::TestBody(void)" 时 14> with 14> [ 14> T=Type 14> ] 14>c:\users\kay chow\documents\caffe-master\src\gtest\gtest.h(7341): note: 参见对正在编译的 类 模板 实例化 "caffe::NetTest_TestLossWeightMidNet_Test<T>" 的引用 14> with 14> [ 14> T=Type 14> ] (编译源文件 ..\..\src\caffe\test\test_net.cpp) 14>c:\users\kay chow\documents\caffe-master\src\gtest\gtest.h(7327): note: 编译 类 模板 成员函数 "bool testing::internal::TypeParameterizedTest<caffe::NetTest,testing::internal::TemplateSel<caffe::NetTest_TestLossWeightMidNet_Test>,caffe::gtest_type_params_NetTest_>::Register(const char *,const char *,const char *,int)" 时 (编译源文件 ..\..\src\caffe\test\test_net.cpp) 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(992): note: 参见对正在编译的函数 模板 实例化“bool testing::internal::TypeParameterizedTest<caffe::NetTest,testing::internal::TemplateSel<caffe::NetTest_TestLossWeightMidNet_Test>,caffe::gtest_type_params_NetTest_>::Register(const char *,const char *,const char *,int)”的引用 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(992): note: 参见对正在编译的 类 模板 实例化 "testing::internal::TypeParameterizedTest<caffe::NetTest,testing::internal::TemplateSel<caffe::NetTest_TestLossWeightMidNet_Test>,caffe::gtest_type_params_NetTest_>" 的引用 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(1010): warning C4838: 从“double”转换到“Dtype”需要收缩转换 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(961): warning C4838: 从“double”转换到“Dtype”需要收缩转换 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(941): note: 编译 类 模板 成员函数 "void caffe::NetTest_TestLossWeight_Test<T>::TestBody(void)" 时 14> with 14> [ 14> T=Type 14> ] 14>c:\users\kay chow\documents\caffe-master\src\gtest\gtest.h(7341): note: 参见对正在编译的 类 模板 实例化 "caffe::NetTest_TestLossWeight_Test<T>" 的引用 14> with 14> [ 14> T=Type 14> ] (编译源文件 ..\..\src\caffe\test\test_net.cpp) 14>c:\users\kay chow\documents\caffe-master\src\gtest\gtest.h(7327): note: 编译 类 模板 成员函数 "bool testing::internal::TypeParameterizedTest<caffe::NetTest,testing::internal::TemplateSel<caffe::NetTest_TestLossWeight_Test>,caffe::gtest_type_params_NetTest_>::Register(const char *,const char *,const char *,int)" 时 (编译源文件 ..\..\src\caffe\test\test_net.cpp) 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(941): note: 参见对正在编译的函数 模板 实例化“bool testing::internal::TypeParameterizedTest<caffe::NetTest,testing::internal::TemplateSel<caffe::NetTest_TestLossWeight_Test>,caffe::gtest_type_params_NetTest_>::Register(const char *,const char *,const char *,int)”的引用 14>c:\users\kay chow\documents\caffe-master\src\caffe\test\test_net.cpp(941): note: 参见对正在编译的 类 模板 实例化 "testing::internal::TypeParameterizedTest<caffe::NetTest,testing::internal::TemplateSel<caffe::NetTest_TestLossWeight_Test>,caffe::gtest_type_params_NetTest_>" 的引用 14>test_reshape_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_scale_layer.cpp 14>test_sigmoid_cross_entropy_loss_layer.cpp 14>test_slice_layer.cpp 14>test_softmax_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_softmax_with_loss_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_solver.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_solver_factory.cpp 14>test_split_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_spp_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_stochastic_pooling.cpp 14>test_syncedmem.cpp 14>test_tanh_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_threshold_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>Unknown compiler version - please run the configure tests and report the results 14>test_tile_layer.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>test_upgrade_proto.cpp 14>test_util_blas.cpp 14>gtest-all.cpp 14>Unknown compiler version - please run the configure tests and report the results 14>已完成生成项目“test_all.vcxproj”的操作 - 失败。 ========== 全部重新生成: 成功 3 个,失败 13 个,跳过 0 个 ==========
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
卸载 x 雷某度!GitHub 标星 1.5w+,从此我只用这款全能高速下载工具!
作者 | Rocky0429 来源 | Python空间 大家好,我是 Rocky0429,一个喜欢在网上收集各种资源的蒟蒻… 网上资源眼花缭乱,下载的方式也同样千奇百怪,比如 BT 下载,磁力链接,网盘资源等等等等,下个资源可真不容易,不一样的方式要用不同的下载软件,因此某比较有名的 x 雷和某度网盘成了我经常使用的工具。 作为一个没有钱的穷鬼,某度网盘几十 kb 的下载速度让我...
2019年还剩1天,我从外包公司离职了
这日子过的可真快啊,2019年还剩1天,外包公司干了不到3个月,我离职了
《面试宝典》2019年springmvc面试高频题(java)
前言 2019即将过去,伴随我们即将迎来的又是新的一年,过完春节,马上又要迎来新的金三银四面试季。那么,作为程序猿的你,是否真的有所准备的呢,亦或是安于本职工作,继续做好手头上的事情。 当然,不论选择如何,假如你真的准备在之后的金三银四跳槽的话,那么作为一个Java工程师,就不可不看了。如何在几个月的时间里,快速的为即将到来的面试进行充分的准备呢? 1、什么是Spring MVC ?简单...
计算机网络的核心概念
这是《计算机网络》系列文章的第二篇文章 我们第一篇文章讲述了计算机网络的基本概念,互联网的基本名词,什么是协议以及几种接入网以及网络传输的物理媒体,那么本篇文章我们来探讨一下网络核心、交换网络、时延、丢包、吞吐量以及计算机网络的协议层次和网络攻击。 网络核心 网络的核心是由因特网端系统和链路构成的网状网络,下面这幅图正确的表达了这一点 那么在不同的 ISP 和本地以及家庭网络是如何交换信息的呢?...
python自动下载图片
近日闲来无事,总有一种无形的力量萦绕在朕身边,让朕精神涣散,昏昏欲睡。 可是,像朕这么有职业操守的社畜怎么能在上班期间睡瞌睡呢,我不禁陷入了沉思。。。。 突然旁边的IOS同事问:‘嘿,兄弟,我发现一个网站的图片很有意思啊,能不能帮我保存下来提升我的开发灵感?’ 作为一个坚强的社畜怎么能说自己不行呢,当时朕就不假思索的答应:‘oh, It’s simple. Wait for me a few
一名大专同学的四个问题
【前言】   收到一封来信,赶上各种事情拖了几日,利用今天要放下工作的时机,做个回复。   2020年到了,就以这一封信,作为开年标志吧。 【正文】   您好,我是一名现在有很多困惑的大二学生。有一些问题想要向您请教。   先说一下我的基本情况,高考失利,不想复读,来到广州一所大专读计算机应用技术专业。学校是偏艺术类的,计算机专业没有实验室更不用说工作室了。而且学校的学风也不好。但我很想在计算机领...
复习一周,京东+百度一面,不小心都拿了Offer
京东和百度一面都问了啥,面试官百般刁难,可惜我全会。
20道你必须要背会的微服务面试题,面试一定会被问到
写在前面: 在学习springcloud之前大家一定要先了解下,常见的面试题有那块,然后我们带着问题去学习这个微服务技术,那么就会更加理解springcloud技术。如果你已经学了springcloud,那么在准备面试的时候,一定要看看看这些面试题。 文章目录1、什么是微服务?2、微服务之间是如何通讯的?3、springcloud 与dubbo有哪些区别?4、请谈谈对SpringBoot 和S...
Java 14 都快来了,为什么还有这么多人固守Java 8?
从Java 9开始,Java版本的发布就让人眼花缭乱了。每隔6个月,都会冒出一个新版本出来,Java 10 , Java 11, Java 12, Java 13, 到2020年3月份,...
轻松搭建基于 SpringBoot + Vue 的 Web 商城应用
首先介绍下在本文出现的几个比较重要的概念: 函数计算(Function Compute): 函数计算是一个事件驱动的服务,通过函数计算,用户无需管理服务器等运行情况,只需编写代码并上传。函数计算准备计算资源,并以弹性伸缩的方式运行用户代码,而用户只需根据实际代码运行所消耗的资源进行付费。Fun: Fun 是一个用于支持 Serverless 应用部署的工具,能帮助您便捷地管理函数计算、API ...
Python+OpenCV实时图像处理
目录 1、导入库文件 2、设计GUI 3、调用摄像头 4、实时图像处理 4.1、阈值二值化 4.2、边缘检测 4.3、轮廓检测 4.4、高斯滤波 4.5、色彩转换 4.6、调节对比度 5、退出系统 初学OpenCV图像处理的小伙伴肯定对什么高斯函数、滤波处理、阈值二值化等特性非常头疼,这里给各位分享一个小项目,可通过摄像头实时动态查看各类图像处理的特点,也可对各位调参、测试...
2020年一线城市程序员工资大调查
人才需求 一线城市共发布岗位38115个,招聘120827人。 其中 beijing 22805 guangzhou 25081 shanghai 39614 shenzhen 33327 工资分布 2020年中国一线城市程序员的平均工资为16285元,工资中位数为14583元,其中95%的人的工资位于5000到20000元之间。 和往年数据比较: yea...
为什么猝死的都是程序员,基本上不见产品经理猝死呢?
相信大家时不时听到程序员猝死的消息,但是基本上听不到产品经理猝死的消息,这是为什么呢? 我们先百度搜一下:程序员猝死,出现将近700多万条搜索结果: 搜索一下:产品经理猝死,只有400万条的搜索结果,从搜索结果数量上来看,程序员猝死的搜索结果就比产品经理猝死的搜索结果高了一倍,而且从下图可以看到,首页里面的五条搜索结果,其实只有两条才是符合条件。 所以程序员猝死的概率真的比产品经理大,并不是错...
害怕面试被问HashMap?这一篇就搞定了!
声明:本文以jdk1.8为主! 搞定HashMap 作为一个Java从业者,面试的时候肯定会被问到过HashMap,因为对于HashMap来说,可以说是Java集合中的精髓了,如果你觉得自己对它掌握的还不够好,我想今天这篇文章会非常适合你,至少,看了今天这篇文章,以后不怕面试被问HashMap了 其实在我学习HashMap的过程中,我个人觉得HashMap还是挺复杂的,如果真的想把它搞得明明白...
毕业5年,我问遍了身边的大佬,总结了他们的学习方法
我问了身边10个大佬,总结了他们的学习方法,原来成功都是有迹可循的。
python爬取百部电影数据,我分析出了一个残酷的真相
2019年就这么匆匆过去了,就在前几天国家电影局发布了2019年中国电影市场数据,数据显示去年总票房为642.66亿元,同比增长5.4%;国产电影总票房411.75亿元,同比增长8.65%,市场占比 64.07%;城市院线观影人次17.27亿,同比增长0.64%。 看上去似乎是一片大好对不对?不过作为一名严谨求实的数据分析师,我从官方数据中看出了一点端倪:国产票房增幅都已经高达8.65%了,为什...
推荐10个堪称神器的学习网站
每天都会收到很多读者的私信,问我:“二哥,有什么推荐的学习网站吗?最近很浮躁,手头的一些网站都看烦了,想看看二哥这里有什么新鲜货。” 今天一早做了个恶梦,梦到被老板辞退了。虽然说在我们公司,只有我辞退老板的份,没有老板辞退我这一说,但是还是被吓得 4 点多都起来了。(主要是因为我掌握着公司所有的核心源码,哈哈哈) 既然 4 点多起来,就得好好利用起来。于是我就挑选了 10 个堪称神器的学习网站,推...
这些软件太强了,Windows必装!尤其程序员!
Windows可谓是大多数人的生产力工具,集娱乐办公于一体,虽然在程序员这个群体中都说苹果是信仰,但是大部分不都是从Windows过来的,而且现在依然有很多的程序员用Windows。 所以,今天我就把我私藏的Windows必装的软件分享给大家,如果有一个你没有用过甚至没有听过,那你就赚了????,这可都是提升你幸福感的高效率生产力工具哦! 走起!???? NO、1 ScreenToGif 屏幕,摄像头和白板...
阿里面试一个ArrayList我都能跟面试官扯半小时
我是真的没想到,面试官会这样问我ArrayList。
曾经优秀的人,怎么就突然不优秀了。
职场上有很多辛酸事,很多合伙人出局的故事,很多技术骨干被裁员的故事。说来模板都类似,曾经是名校毕业,曾经是优秀员工,曾经被领导表扬,曾经业绩突出,然而突然有一天,因为种种原因,被裁员了,...
大学四年因为知道了这32个网站,我成了别人眼中的大神!
依稀记得,毕业那天,我们导员发给我毕业证的时候对我说“你可是咱们系的风云人物啊”,哎呀,别提当时多开心啦????,嗯,我们导员是所有导员中最帅的一个,真的???? 不过,导员说的是实话,很多人都叫我大神的,为啥,因为我知道这32个网站啊,你说强不强????,这次是绝对的干货,看好啦,走起来! PS:每个网站都是学计算机混互联网必须知道的,真的牛杯,我就不过多介绍了,大家自行探索,觉得没用的,尽管留言吐槽吧???? 社...
2020年1月中国编程语言排行榜,python是2019增长最快编程语言
编程语言比例 排名 编程语言 最低工资 工资中位数 最低工资 最高工资 人头 人头百分比 1 rust 20713 17500 5042 46250 480 0.14% 2 typescript 18503 22500 6000 30000 1821 0.52% 3 lua 18150 17500 5250 35000 2956 0.84% 4 go 17989 16...
看完这篇HTTP,跟面试官扯皮就没问题了
我是一名程序员,我的主要编程语言是 Java,我更是一名 Web 开发人员,所以我必须要了解 HTTP,所以本篇文章就来带你从 HTTP 入门到进阶,看完让你有一种恍然大悟、醍醐灌顶的感觉。 最初在有网络之前,我们的电脑都是单机的,单机系统是孤立的,我还记得 05 年前那会儿家里有个电脑,想打电脑游戏还得两个人在一个电脑上玩儿,及其不方便。我就想为什么家里人不让上网,我的同学 xxx 家里有网,每...
史上最全的IDEA快捷键总结
现在Idea成了主流开发工具,这篇博客对其使用的快捷键做了总结,希望对大家的开发工作有所帮助。
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
谁是华为扫地僧?
是的,华为也有扫地僧!2020年2月11-12日,“养在深闺人不知”的华为2012实验室扫地僧们,将在华为开发者大会2020(Cloud)上,和大家见面。到时,你可以和扫地僧们,吃一个洋...
Idea 中最常用的10款插件(提高开发效率),一定要学会使用!
学习使用一些插件,可以提高开发效率。对于我们开发人员很有帮助。这篇博客介绍了开发中使用的插件。
AI 没让人类失业,搞 AI 的人先失业了
最近和几个 AI 领域的大佬闲聊 根据他们讲的消息和段子 改编出下面这个故事 如有雷同 都是巧合 1. 老王创业失败,被限制高消费 “这里写我跑路的消息实在太夸张了。” 王葱葱哼笑一下,把消息分享给群里。 阿杰也看了消息,笑了笑。在座几位也都笑了。 王葱葱是个有名的人物,21岁那年以全额奖学金进入 KMU 攻读人工智能博士,累计发表论文 40 余篇,个人技术博客更是成为深度学习领域内风向标。 ...
立即提问