无法找到 vcvarsall.bat 错误
unable to find vcvarsall.bat error
我正在使用 Python 版本 3.5.2。
我正在尝试编辑 MSWord 文档中的单词和段落。
在此之前,我需要安装 docx
模块。
在命令行中,我将其指向路径:
C:\Users\d\AppData\Local\Programs\Python\Python35-32\Scripts
并输入:
pip install python-docx.
点击 return 后,我收到此错误消息(完整输出如下):
"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 版本是您从预编译的 "binary installation package" 安装 lxml
,并为您处理所有细节。
您可以在这里找到其中之一:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
'cp' 段代表 'C Python'(例如常规 Python,与 PyPy 相对)和版本,因此如果您使用的是 Python 2.7您想要名称中带有 -cp27-
的软件包之一。其中有两种,一种用于 32 位,一种用于 64 位。您可能需要 32 位,因为 .
下载二进制安装包("wheel")后,使用pip
进行安装,例如:
pip install lxml‑3.6.4‑cp27‑cp27m‑win32.whl
我正在使用 Python 版本 3.5.2。
我正在尝试编辑 MSWord 文档中的单词和段落。
在此之前,我需要安装 docx
模块。
在命令行中,我将其指向路径:
C:\Users\d\AppData\Local\Programs\Python\Python35-32\Scripts
并输入:
pip install python-docx.
点击 return 后,我收到此错误消息(完整输出如下):
"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 版本是您从预编译的 "binary installation package" 安装 lxml
,并为您处理所有细节。
您可以在这里找到其中之一: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
'cp' 段代表 'C Python'(例如常规 Python,与 PyPy 相对)和版本,因此如果您使用的是 Python 2.7您想要名称中带有 -cp27-
的软件包之一。其中有两种,一种用于 32 位,一种用于 64 位。您可能需要 32 位,因为
下载二进制安装包("wheel")后,使用pip
进行安装,例如:
pip install lxml‑3.6.4‑cp27‑cp27m‑win32.whl