草庐IT

python - 使用 pip freeze 忽略某些包及其依赖项

标题基本上说明了一切。我如何告诉pipfreeze忽略某些包,如pylint和pep8及其依赖项? 最佳答案 我的方法如下:我在.bashrc创建以下别名:aliaspipfreezeignore='pipfreeze|grep-vFxfignore_requirements.txt'创建虚拟环境,首先安装所有我不想跟踪的包(即pipinstalljediflake8importmagicautopep8yapf)。立即将它们保存在ignore_requirements.txt文件中,如pipfreeze>ignore_requir

python - 更新时 Opencv imshow() 卡住

对于我的图像处理算法,我使用的是python/OpenCV。我的算法的输出应在同一个窗口中一遍又一遍地更新。然而有时窗口会卡住并且根本不更新,但算法仍在运行并在此期间多次更新图片。在这台Ubuntu机器上,窗口变成深灰色。以下是相关代码的摘录:foriinrange(0,1000):img=loadNextImg()procImg=processImg(img)cv2.imshow("Theresult",procImg)cv2.waitKey(1)注意:processImg()的过程大约需要1-2秒。cv2.imshow(procImg)行在第一个实例中创建窗口(即没有前面的调用)

python - 使用 cx_Freeze 和 tkinter 时,我得到 : "DLL load failed: The specified module could not be found." (Python 3. 5.3)

当使用cx_Freeze和Tkinter时,我收到消息:File"C:\Users\VergilTheHuragok\AppData\Local\Programs\Python\Python35-32\lib\tkinter\__init__.py",line35,inimport_tkinter#IfthisfailsyourPythonmaynotbeconfiguredforTkImportError:DLLloadfailed:Thespecifiedmodulecouldnotbefound.一些注意事项:我想使用Python3+(目前使用3.5.3,32位)。并不真正关心特

Python Popen().stdout.read() 挂起

我正在尝试使用Python的subprocess.Popen获取另一个脚本的输出,如下所示process=Popen(command,stdout=PIPE,shell=True)exitcode=process.wait()output=process.stdout.read()#hangshere它卡在第三行,只有当我将它作为python脚本运行并且我无法在pythonshell中重现时才挂起。另一个脚本只打印了几个字,我假设这不是缓冲区问题。有人知道我在这里做错了什么吗? 最佳答案 您可能想使用.communicate()而不

python - cx_Freeze - 防止包含不需要的包

我使用PyQt4编写了一个小型python程序。现在,我想使用cx_Freeze创建一个独立的应用程序。一切正常——cx_Freeze自动包含所有必要的模块;生成的exe有效。唯一的问题是cx_Freeze将大量不需要的模块打包到独立的模块中。尽管我只使用QtCore和QtGui,但也包括sqlite3、QtNetwork或QtScript等模块。令人惊讶的是,我在生成的文件夹中还找到了PyQt5dll。在我看来,好像cx_Freeze使用了我安装的所有PyQt包。结果是一个200Mb的程序-尽管我只写了一个小脚本。如何防止这种行为?我使用以下setup.py:importsysfro

python - 在 Ubuntu 上编译 cx_Freeze 时出错

我在Ubuntu上使用Python3.3.2,当我从源代码编译cx_Freeze时,出现以下错误,有什么想法吗?philip@linuxmint~/cx_Freeze-4.3.2$sudopython3setup.pyinstall[sudo]passwordforphilip:addingbasemodulenamed_dummy_threadaddingbasemodulenamed_frozen_importlibaddingbasemodulenamed_strptimeaddingbasemodulenamed_threading_localaddingbasemodulen

python - TensorFlow freeze_graph.py : The name 'save/Const:0' refers to a Tensor which does not exist

我目前正在尝试将经过训练的TensorFlow模型导出为ProtoBuf文件,以便在Android上将其与TensorFlowC++API一起使用。因此,我正在使用freeze_graph.py脚本。我使用tf.train.write_graph导出了我的模型:tf.train.write_graph(graph_def,FLAGS.save_path,out_name,as_text=True)我正在使用通过tf.train.Saver保存的检查点。我按照脚本顶部的描述调用freeze_graph.py。编译后运行bazel-bin/tensorflow/python/tools/f

python - cx_Freeze : “No module named ' codecs'” Windows 10

我目前正在使用pygame模块制作游戏。我已按照以下链接的说明进行操作。https://pythonprogramming.net/converting-pygame-executable-cx_freeze/我已经解决了一些问题,例如KeyErrorKeyError:'TCL_Library'whenIusecx_Freeze属性错误AttributeErrorwhileusingcx_Freezesetup.py的构建已经完成,但是当我运行游戏的exe文件时,它崩溃并出现致命的Python错误:Py_Initialize:无法加载文件系统编解码器FatalPythonerror:P

python - cx_Freeze : “No module named ' codecs'” Windows 10

我目前正在使用pygame模块制作游戏。我已按照以下链接的说明进行操作。https://pythonprogramming.net/converting-pygame-executable-cx_freeze/我已经解决了一些问题,例如KeyErrorKeyError:'TCL_Library'whenIusecx_Freeze属性错误AttributeErrorwhileusingcx_Freezesetup.py的构建已经完成,但是当我运行游戏的exe文件时,它崩溃并出现致命的Python错误:Py_Initialize:无法加载文件系统编解码器FatalPythonerror:P

python - 从 。导入_方法 ImportError : cannot import name '_methods' in cx-freeze python

exe使用cx-freeze成功构建。但是当我执行exe文件时它显示以下错误:from.import_methodsImportError:cannotimportname'_methods' 最佳答案 这个问题已经在这里回答:WhyamIgettingthisImportError?但为了完整起见,这里是针对这种特定情况的答案:cx_freeze未导入可选模块_method,因此您必须明确告诉他这样做。additional_mods=['numpy.core._methods','numpy.lib.format']setup(n