- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
以下代码运行良好,并在作为解释型 python py 程序运行时显示一个简单的饼图。
一个月前,我使用 pyinstaller 创建了一个独立的 exe,效果很好。
最近,我决定重建exe。 pyinstaller 构建成功完成,没有错误,但生成的 exe 运行时什么也不做。当我运行它时,它很快结束,没有任何错误,也没有显示饼图。自一个月前以来发生了一些变化,但我无法弄清楚是什么。我试过卸载 python 和所有模块并重新安装,但这没有任何区别。
from pylab import *
from matplotlib import pyplot as plt
figure(1, figsize=(6,6))
ax = axes([0.1, 0.1, 0.8, 0.8])
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
fracs = [15, 30, 45, 10]
explode=(0, 0.05, 0, 0)
pie(fracs, explode=explode, labels=labels,
autopct='%1.1f%%', startangle=90)
title('Pie Chart Example', bbox={'facecolor':'0.8', 'pad':5})
show()
这是我用来构建 exe 的 pyinstaller 命令。此命令适用于其他 pyqt gui 构建,它们的 exe 工作正常。我只是在构建 pylab/matplotlib python 代码时遇到问题。
c:/python27/python.exe c:/pyinstaller/pyinstaller.py --noconfirm --noconsole --onefile --icon=pie.ico pie.py
最佳答案
找到解决方案。显然我的 pyinstaller 版本有一个错误。在 pyinstaller 的网站上找到这篇文章:http://www.pyinstaller.org/ticket/651
所以我下载了最新的 pyinstaller,我可以再次构建我的饼图 python 程序的 exe!
关于python - 使用 pyinstaller 构建 python pylab/matplotlib exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17095180/
我注意到pylab中有一些名称重复。假设我导入 pylab。以下是一些示例: 例如1: pylab.ion() pylab.plt.ion() 例如2 pylab.figure(1) pylab.pl
我希望情节线覆盖文本。这是当前代码: pylab.plot( data[:,0], data[:,1], color='red', lw=3, label='Temp' ) pylab.figtext
这个问题在这里已经有了答案: pylab.ion() in python 2, matplotlib 1.1.1 and updating of the plot while the program
我正在使用 pylab 绘制一些数据,一切都按我的预期完美运行。我有 6 个不同的图表要绘制,我可以将它们单独绘制在单独的图中。但是当我尝试 subplot() 这些图表时,最后一个 (subplot
我有两个数组 x、y 以及函数的坐标。 示例: x=[0,1,2,3,4,5] y=[0,1,5,20,30,32] pylab.plot(x,y) 向我展示了一个平滑的函数。 有没有办法获取y=3的
我正在使用以下代码制作一个非常简单的 pandas/pylab 条形图: df2 = pd.DataFrame(np.random.rand(10, 4), columns=['a', 'b', 'c
我正在使用 PyBrain,在文档中它使用 PyLab...我尝试导入 PyLab 并且它有效,但是当我尝试使用其中的任何模块时,python 返回错误。 >>> import pylab
我需要修改我的图例。 noise_mu 具有诸如 1.6e-29 之类的值,我希望它能够以科学的方式准确绘制。不幸的是,我的图例总是以 0.000000000000000000000016 的形式打印
我有一个 mac OS X Yosimite,我使用 python 2.7.10 和 Pycharm 作为我的 IDLE。我已经正确安装了 pylab,但无法使用它的任何模块。 尝试时: from p
我正在尝试关注 this PCA tutorial并且在尝试使用 启动 pylab 时遇到了障碍 $pylab inline 我在哪里遇到语法错误。我正在使用 Anaconda/Spyder 和 Py
我正在使用 PyLab 在 Python 中制作一些图表。我想制作一个带有黑色文本的洋红色文本框,但无法将文本变为黑色。 text(x, y, 'Summary', backgroundcolor =
我访问了scipy site for PyLab.我在那里找不到它的文档。 matplotlib site也没有提供任何关于它的信息。 我在哪里可以找到 PyLab 的教程/文档? 最佳答案 Pyla
我确定这是一个非常基本的问题,但我似乎找不到正确的代码。我正在创建的箱线图有我的代码。我想标记轴并有一个标题。 from pylab import * import numpy raw_data =
我不断看到人们在各种代码片段中使用 %pylab,尤其是使用 iPython。但是,我看不到“学习 Python”(以及我拥有的其他几本 Python 书籍)中的任何地方提到了 %pylab,也不确定
我已经在 Mac (OSX Lion) 上安装了 iPython + SciPy Superpack。 如果我使用 matplotlib.pyplot 绘图,它会弹出一个带有图形的窗口,我关闭它以便
我有用于绘制以下捕食者猎物模型的代码: dx/dt = x − xy, dy/dt = −y + xy from pylab import * xvalues, yvalues = meshgrid(
我正在绘制图表并使用 pylab.poly1d 函数绘制最佳拟合线。但最佳拟合线不够长。我怎样才能延长这条线。这是我的代码: y=np.genfromtxt('_02total.txt').T[0]
我正在尝试绘制方波的傅立叶序列,但是对于许多项,该程序需要太多时间来计算所有点。我尝试使用多处理模块但没有成功。请帮助我如何使用多处理。我正在 fedora linux 上运行,并拥有 AMD FX
我有一个小代码,用此代码生成以下图片: 代码1: hist, rhist = np.histogram(r, bins=40, range=(0, 0.25)) hist = -hist/np.tra
是否可以使 pylab.show() 不会忘记? 我的意思是这样的: x = np.linspace(0, 10, 1000) y = np.sin(x) pylab.plot(x, y) pylab
我是一名优秀的程序员,十分优秀!