当我尝试运行Python 3.13时,它立即给出“ImportError”

问题描述 投票:0回答:1

我输入命令“python3.13”(在 MacOS/terminal/csh 上)并得到响应:

Traceback (most recent call last):
  File "/Users/prowat/.pythonstartup", line 6, in <module>
    from math import pi, coth, cos, tanh, cosh, log, exp, pow, sqrt, fabs, expm1
ImportError: cannot import name 'coth' from 'math' (/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/lib-dyn
>>> 

我不知道那个

.pythonstartup
文件是什么,也不知道它是如何到达那里的。

如何解决这个问题?

我尝试运行最新的Python,Python3.13,并立即得到上述响应。

python python-3.x
1个回答
0
投票

我也不知道你的

.pythonstartup
文件来自哪里,但我认为它不是来自安装Python,因为文件错误。

启动 Python 时,将读取并执行主目录中的

.pythonstartup
文件。 你不需要它,而且在我看来你也不想要它。 您可以通过从第 6 行的函数名称列表中删除
coth
来修复特定错误(
math
模块没有这样的函数),但我建议重命名它,以便 Python 根本不会读取它。 我可能甚至会删除它,但在不知道它从哪里来或如何到达那里的情况下,我犹豫是否建议这样做。

© www.soinside.com 2019 - 2024. All rights reserved.