擅长:python、mysql、java
<p>我不使用这个软件包,但是这个错误很容易诊断。从<a href="http://pythonhosted.org/OrbitalPy/modules/utilities/#orbital.utilities.StateVector" rel="nofollow noreferrer">the docs</a>可以看出,<code>orbital.utilities.StateVector</code>有两个参数;一个用于“位置”,另一个用于“速度”。当您执行<code>orbital.utilities.StateVector(orbitPineapple)</code>时,您只提供一个参数(<code>orbitPineapple</code>),其值将被视为表示“位置”。你也需要提供速度。在</p>
<p>至于错误<code>...takes exactly 3 arguments (2 given)</code>,python高估了类方法所需/传递的参数数量,因为它在计算参数时考虑了<code>self</code>参数。例如:</p>
<pre><code>class Testing(object):
def __init__(self):
self.a = 2
def do_something(self, b):
self.a += b
obj = Testing()
obj.do_something(2, 3) # Clearly passing only 2 arguments
</code></pre>
<p>给出:</p>
^{pr2}$
<p>所以你可以把错误解读为“接受2个参数,但你只给出了1个”</p>