擅长:python、mysql、java
<p>第二种方法是正确的</p>
<p>要解决导入问题,应使用不同的方法修复python代码:
在下面的代码中<code>curdir</code>将有脚本所在的文件夹的名称,您可以根据需要进行操作</p>
<pre class="lang-py prettyprint-override"><code>import sys
import os
curdir = os.path.dirname(__file__)
</code></pre>
<p>或者可以使用批处理脚本更改工作目录。
勾选<a href="https://stackoverflow.com/questions/5138507/how-to-change-current-working-directory-using-a-batch-file/5138524#:%7E:text=Just%20use%20cd%20%2Fd%20%25root,directories%20to%20a%20network%20share.">How to change current working directory using a batch file
</a></p>