擅长:python、mysql、java
<p>首先下载xlwt文件夹并将其解压到python/any目录中</p>
<p>如果将chdir设置为Xlwt文件夹,那么python将只查看该文件夹,因此要从python homeditory查看Xlwt目录,只需在程序的开头添加这两行代码。</p>
<ol>
<li><code>import sys</code></li>
<li><code>sys.path.insert(0,new_path)
where new_path is the path of xlwt folder</code></li>
</ol>
<p>现在您可以使用import xlwt,它将工作正常。</p>
<pre><code>import sys
sys.path.insert(0,'C:/Python27/xlwt-0.7.5')
</code></pre>