gpt4 book ai didi

python - 无法找到 vcvarsall.bat 错误

转载 作者:太空宇宙 更新时间:2023-11-04 05:19:40 25 4
gpt4 key购买 nike

我使用的是 Python 3.5.2 版。

我正在尝试编辑 MSWord 文档中的单词和段落。

在此之前,我需要安装 docx 模块。

在命令行中我将其指向路径:

C:\Users\d\AppData\Local\Programs\Python\Python35-32\Scripts 

然后输入:

pip install python-docx. 

点击回车后,我收到此错误消息(完整输出如下):

"unable to find vcvarsall.bat".

我该如何修复这个错误?


c:\Users\D\AppData\Local\Programs\Python\Python35-32\Scripts>pip install
python-docx
Collecting python-docx
Using cached python-docx-0.8.6.tar.gz
Collecting lxml>=2.3.2 (from python-docx)
Using cached lxml-3.6.4.tar.gz
Installing collected packages: lxml, python-docx
Running setup.py install for lxml ... error
Complete output from command c:\users\d\appdata\local\programs\python
\python35-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\
D\\AppData\\Local\\Temp\\pip-build-9yk1nedc\\lxml\\setup.py';f=getattr(to
kenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();ex
ec(compile(code, __file__, 'exec'))" install --record C:\Users\D\AppData\
Local\Temp\pip-pepj9c3f-record\install-record.txt --single-version-externally-ma
naged --compile:
Building lxml version 3.6.4.
Building without Cython.
ERROR: b"'xslt-config' is not recognized as an internal or external command,
\r\noperable program or batch file.\r\n"
** make sure the development packages of libxml2 and libxslt are installed *
*
Using build configuration of libxslt
running install
running build
running build_py
creating build
creating build\lib.win32-3.5
creating build\lib.win32-3.5\lxml
copying src\lxml\builder.py -> build\lib.win32-3.5\lxml
copying src\lxml\cssselect.py -> build\lib.win32-3.5\lxml
copying src\lxml\doctestcompare.py -> build\lib.win32-3.5\lxml
copying src\lxml\ElementInclude.py -> build\lib.win32-3.5\lxml
copying src\lxml\pyclasslookup.py -> build\lib.win32-3.5\lxml
copying src\lxml\sax.py -> build\lib.win32-3.5\lxml
copying src\lxml\usedoctest.py -> build\lib.win32-3.5\lxml
copying src\lxml\_elementpath.py -> build\lib.win32-3.5\lxml
copying src\lxml\__init__.py -> build\lib.win32-3.5\lxml
creating build\lib.win32-3.5\lxml\includes
copying src\lxml\includes\__init__.py -> build\lib.win32-3.5\lxml\includes
creating build\lib.win32-3.5\lxml\html
copying src\lxml\html\builder.py -> build\lib.win32-3.5\lxml\html
copying src\lxml\html\clean.py -> build\lib.win32-3.5\lxml\html
copying src\lxml\html\defs.py -> build\lib.win32-3.5\lxml\html
copying src\lxml\html\diff.py -> build\lib.win32-3.5\lxml\html
copying src\lxml\html\ElementSoup.py -> build\lib.win32-3.5\lxml\html
copying src\lxml\html\formfill.py -> build\lib.win32-3.5\lxml\html
copying src\lxml\html\html5parser.py -> build\lib.win32-3.5\lxml\html
copying src\lxml\html\soupparser.py -> build\lib.win32-3.5\lxml\html
copying src\lxml\html\usedoctest.py -> build\lib.win32-3.5\lxml\html
copying src\lxml\html\_diffcommand.py -> build\lib.win32-3.5\lxml\html
copying src\lxml\html\_html5builder.py -> build\lib.win32-3.5\lxml\html
copying src\lxml\html\_setmixin.py -> build\lib.win32-3.5\lxml\html
copying src\lxml\html\__init__.py -> build\lib.win32-3.5\lxml\html
creating build\lib.win32-3.5\lxml\isoschematron
copying src\lxml\isoschematron\__init__.py -> build\lib.win32-3.5\lxml\isosc
hematron
copying src\lxml\lxml.etree.h -> build\lib.win32-3.5\lxml
copying src\lxml\lxml.etree_api.h -> build\lib.win32-3.5\lxml
copying src\lxml\includes\c14n.pxd -> build\lib.win32-3.5\lxml\includes
copying src\lxml\includes\config.pxd -> build\lib.win32-3.5\lxml\includes
copying src\lxml\includes\dtdvalid.pxd -> build\lib.win32-3.5\lxml\includes
copying src\lxml\includes\etreepublic.pxd -> build\lib.win32-3.5\lxml\includ
es
copying src\lxml\includes\htmlparser.pxd -> build\lib.win32-3.5\lxml\include
s
copying src\lxml\includes\relaxng.pxd -> build\lib.win32-3.5\lxml\includes
copying src\lxml\includes\schematron.pxd -> build\lib.win32-3.5\lxml\include
s
copying src\lxml\includes\tree.pxd -> build\lib.win32-3.5\lxml\includes
copying src\lxml\includes\uri.pxd -> build\lib.win32-3.5\lxml\includes
copying src\lxml\includes\xinclude.pxd -> build\lib.win32-3.5\lxml\includes
copying src\lxml\includes\xmlerror.pxd -> build\lib.win32-3.5\lxml\includes
copying src\lxml\includes\xmlparser.pxd -> build\lib.win32-3.5\lxml\includes

copying src\lxml\includes\xmlschema.pxd -> build\lib.win32-3.5\lxml\includes

copying src\lxml\includes\xpath.pxd -> build\lib.win32-3.5\lxml\includes
copying src\lxml\includes\xslt.pxd -> build\lib.win32-3.5\lxml\includes
copying src\lxml\includes\etree_defs.h -> build\lib.win32-3.5\lxml\includes
copying src\lxml\includes\lxml-version.h -> build\lib.win32-3.5\lxml\include
s
creating build\lib.win32-3.5\lxml\isoschematron\resources
creating build\lib.win32-3.5\lxml\isoschematron\resources\rng
copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib
.win32-3.5\lxml\isoschematron\resources\rng
creating build\lib.win32-3.5\lxml\isoschematron\resources\xsl
copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win
32-3.5\lxml\isoschematron\resources\xsl
copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win
32-3.5\lxml\isoschematron\resources\xsl
creating build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron
-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstra
ct_expand.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schema
tron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_i
nclude.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematro
n-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schema
tron_message.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-sch
ematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schema
tron_skeleton_for_xslt1.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\
xsl\iso-schematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_f
or_xslt1.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schemat
ron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt
-> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
error: Unable to find vcvarsall.bat
----------------------------------------
Command "c:\users\d\appdata\local\programs\python\python35-32\python.exe
-u -c "import setuptools, tokenize;__file__='C:\\Users\\D\\AppData\\Local
\\Temp\\pip-build-9yk1nedc\\lxml\\setup.py';f=getattr(tokenize, 'open', open)(__
file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file_
_, 'exec'))" install --record C:\Users\D\AppData\Local\Temp\pip-pepj9c3f-
record\install-record.txt --single-version-externally-managed --compile" failed
with error code 1 in C:\Users\D\AppData\Local\Temp\pip-build-9yk1nedc\lxm
l\

最佳答案

这是在 Windows 上安装 lxml Python 库的一个众所周知的问题。

此处的 TL;DR 版本是您从预编译的“二进制安装包”安装 lxml 并为您处理所有细节。

您可以在这里找到其中之一: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

“cp”段代表“C Python”(常规 Python,例如与 PyPy 相对)和版本,因此如果您使用的是 Python 2.7,则需要带有 -cp27- 的包之一 在名称中。其中有两种,一种用于 32 位,一种用于 64 位。您可能需要 32 位,因为 that's the default Python install on Windows .

下载二进制安装包(“wheel”)后,使用 pip 安装它,例如:

pip install lxml‑3.6.4‑cp27‑cp27m‑win32.whl

关于python - 无法找到 vcvarsall.bat 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40756746/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com