Python 找不到vcvarsall.bat错误

Python 找不到vcvarsall.bat错误,python,docx,xls,python-docx,Python,Docx,Xls,Python Docx,我使用的是Python版本3.5.2 我正在努力编辑MSWord文档中的单词和段落 在此之前,我需要安装docx模块 在命令行中,我将其指向路径: C:\Users\d\AppData\Local\Programs\Python\Python35-32\Scripts 和类型: pip install python-docx. 点击return后,我得到了这个错误消息(下面是完整的输出): 如何修复此错误 在Windows上安装lxml Python库时,这是一个众所周知的问题 TL;

我使用的是Python版本3.5.2

我正在努力编辑MSWord文档中的单词和段落

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

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

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

pip install python-docx. 
点击return后,我得到了这个错误消息(下面是完整的输出):

如何修复此错误



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

TL;这里的DR版本是您从一个“二进制安装包”安装的
lxml
,该安装包经过预编译,为您提供所有细节

您可以在此处找到其中之一:

“cp”段代表“C Python”(例如,与PyPy相反的是普通Python)及其版本,因此,如果您使用的是python2.7,您希望其中一个包的名称中包含
-cp27-
。其中有两种,一种用于32位,另一种用于64位。您可能需要32位,因为

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

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

在Windows上安装
lxml
Python库时,这是一个众所周知的问题。快速搜索“python docx windows lxml安装”将提供您所需的所有信息,包括其他问题,例如:。感谢您的反馈。所以,在运行pip install python docx之前,我似乎必须安装lxml,但我应该使用哪个lxml,以及如何提取来安装它?感谢下面的lxml链接:我刚刚开始使用Python。我使用的是Python版本3.5.2和Windows7操作系统64位。因此,根据我使用的内容,我下载了
lxml-3.6.4-cp35-cp35m-win\u amd64.whl
并将该文件添加到脚本目录C:\Users\d\AppData\Local\Programs\Python\Python 35-32\Scripts中,然后在命令提示符下指向该文件夹,我键入
pip install lxml-3.6.4-cp35-cp35m-win_amd64.whl
并得到错误消息:lxml-3.6.4-cp35-cp35m-win_amd64.whl在此平台上不受支持。@johnsito我认为我无法帮助您,可能有太多的变量。我首先要将.whl文件移动到其他地方,比如桌面或文档文件夹。它不需要在一个特殊的地方,很难说它现在所在的“特殊”文件夹是否是问题的一部分。然后我怀疑
pip
使用的Python不是3.5.2安装;您可以在一台计算机上安装多个Python。我能想到的另一件事是,pip版本可能太旧了,请尝试
pip--version
,如果不是至少8.something.Ok版本,请升级。正常情况下,当我安装Python 3.5.2时,它附带了pip版本8.1.1,然后我可以将其升级到9.0.1。对于两个pip版本,无论我将文件放在何处,都会出现相同的错误消息。我将把这个错误信息放到谷歌上,并对它做一些研究。我很高兴地说,我做了一些研究,发现了这个问题,并能够解决它。我必须选择32位的lxml二进制文件
lxml-3.6.4-cp35-cp35m-win32.whl
,即使我的系统是64位的,因为python安装默认为windows的32位,根据这一点:啊,很高兴知道@johnsito,很高兴它能工作:)我将更新我的答案以反映更多细节。不要忘记接受你认为最好的答案。这是成功的重要原因:)
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\
pip install lxml‑3.6.4‑cp27‑cp27m‑win32.whl