我尝试在 docker 中安装 python 模块 psutil python:3.9.13-alpine3.16
\n但它报告以下错误:
Building wheels for collected packages: psutil\n Building wheel for psutil (pyproject.toml) ... error\n error: subprocess-exited-with-error\n \n \xc3\x97 Building wheel for psutil (pyproject.toml) did not run successfully.\n \xe2\x94\x82 exit code: 1\n \xe2\x95\xb0\xe2\x94\x80> [51 lines of output]\n /tmp/tmpb62wij4i.c:1:10: fatal error: linux/ethtool.h: No such file or directory\n 1 | #include <linux/ethtool.h>\n | ^~~~~~~~~~~~~~~~~\n compilation terminated.\n running bdist_wheel\n running build\n running build_py\n creating build\n creating build/lib.linux-x86_64-cpython-39\n creating build/lib.linux-x86_64-cpython-39/psutil\n copying psutil/__init__.py -> build/lib.linux-x86_64-cpython-39/psutil\n copying psutil/_common.py -> …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用discord.py制作按钮,一切都很好并且按钮工作良好,但即使它给出了错误消息“此交互失败”
\nasync def dashboard():\n embed=discord.Embed(title="Tile", description="Desc", color=0x00ff00)\n embed.add_field(name="Fiel1", value="hi", inline=False)\n embed.add_field(name="Field2", value="hi2", inline=False)\n\n channel = bot.get_channel(dashboard_channel_id)\n await channel.send(\n embed=embed,\n components=[[\n Button(label="\xd8\xb9\xd8\xa7\xd9\x85"),\n Button(label="\xd8\xae\xd8\xa7\xd8\xb5"),\n Button(label="\xd9\x83\xd8\xaa\xd9\x85 \xd8\xa7\xd9\x84\xd8\xb5\xd9\x88\xd8\xaa"),\n Button(label="\xd9\x81\xd9\x83 \xd9\x83\xd8\xaa\xd9\x85 \xd8\xa7\xd9\x84\xd8\xb5\xd9\x88\xd8\xaa"),\n ]]\n )\nRun Code Online (Sandbox Code Playgroud)\n为了使按钮做出反应,我使用 on_button_click 事件
\n@bot.event\nasync def on_button_click(interaction):\n print("Button clicked")\nRun Code Online (Sandbox Code Playgroud)\n我尝试使用 on_error 事件,这样我就可以阻止“此交互失败”消息,但这不起作用,我只是希望即使代码无效,它也不会显示此错误。相反,我想提出它
\n我一直致力于绘制一个函数并朝 y 轴和 x 轴旋转。然后使用 SymPy 获取表面积。
我尝试从终端和运行.py文件,两者都花费太长时间来计算积分以获得表面积。
这是我的代码:
import numpy as np
import sympy as sy
x = sy.Symbol("x")
def f(x):
return ((x**6) + 2)/ (8*x ** 2)
def fd(x):
return sy.simplify(sy.diff(f(x), x))
def vx(x):
return 2*np.pi*(f(x)*((1 + (fd(x) ** 2))**(1/2)))
vx = sy.integrate(vx(x), (x, 1, 3))
Run Code Online (Sandbox Code Playgroud)
我的问题:
sy.integrate花了这么长时间?差不多30分钟..这个函数很难计算吗?从终端来看,直到我在 SoF 提出这个问题之前,它甚至还没有完成积分计算:
这是来自 的答案sy.integrate:
0.392699081698724*Integral(2*(x**2 + 1)**1.0*Abs(x**4 - x**2 + 1)**1.0/x**5.0, (x, 1, 3)) + 0.392699081698724*Integral(x**1.0*(x**2 + 1)**1.0*Abs(x**4 - x**2 + …Run Code Online (Sandbox Code Playgroud) 我有一个像下面这样的字典列表
[[{1:'a',2:'b'},{1:'g',2:'y'}],[{1:'r',2:'i'},{1:'t',2:'o'},{1:'q',2:'e'}],[{1:'p',2:'f'}]]
Run Code Online (Sandbox Code Playgroud)
我想提取输出值如下
ag - 第一个列表的第一个值 按第一个列表的第二个值 rtq - 第二个列表的第一个值 ioe - 第二个列表的第二个值 p - 第三个列表的第一个值 f- 第三个列表的第二个值
我想要类似的输出有人能建议我该怎么做吗?
python ×4
alpine-linux ×1
dictionary ×1
discord ×1
discord.py ×1
key ×1
makefile ×1
numpy ×1
psutil ×1
sympy ×1