擅长:python、mysql、java
<p>您不必通过<code>userSetup.py</code>动态添加路径。在</p>
<p>请确保在您的<code>Maya.env</code>中包含<code>PYTHONPATH</code>:</p>
<p><code>PYTHONPATH=C:\Users\roroco\OneDrive\maya\script</code></p>
<p>在检查我的Windows home安装程序时,我使用了<code>Maya.env</code>中的反斜杠,因此您可以查看切换是否有帮助。不要检查<code>MAYA_PATH_DIR</code>,而是检查您的<code>sys.path</code>,看看您的目录是否在那里。所有Python模块都需要位于以下目录之一才能导入:</p>
<pre><code>import sys
for p in sys.path:
print p
</code></pre>
<p>您还可以复制并粘贴路径到<code>os.path.exists</code>,以确认它确实存在。有时它是正确的路径,但斜线使它无法正确解决。在</p>