我已经尝试了一切,但我不知道从这里该去哪里。当我调用命令时pip install python-docx
我明白了:
running build_ext
building 'lxml.etree' extension
error: Unable to find vcvarsall.bat
----------------------------------------
Command "c:\users\alex\appdata\local\programs\python\python35-32\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\Alex\\AppData\\Local\\Temp\\pip-build-u2i_l872\\lxml\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\Alex\AppData\Local\Temp\pip-26nq6ot7-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Alex\AppData\Local\Temp\pip-build-u2i_l872\lxml
在最后。
我尝试找到 vsvarsall.bat 并设置路径。我似乎在 C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools 中找不到它,并且 C:\Program Files\Microsoft Visual Studio 12.0\Common7 中没有工具文件夹。我使用的是 64 位 Windows 10 和 python 3.5.1。
这是人们在使用 Python 模块时遇到的一个非常常见的问题。您可以在这里阅读更多相关内容 https://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat?rq=1
您可以做的是安装 lxml 的预编译版本,这是 python-docx 依赖的模块。您可以通过查看错误消息或查看python-docx github 页面在这里 https://github.com/python-openxml/python-docx/blob/master/requirements.txt,其中列出了 python-docx 的所有要求。
幸运的是,Christoph Golke为我们提供了一些预编译模块,可以在这里找到 http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml。
首先从 Christoph Golke 下载并安装 lxml 模块,然后尝试重新运行 pip install。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)