我尝试安装Python包dulwich:
pip install dulwich
但我收到了一条神秘的错误消息:
error: Unable to find vcvarsall.bat
如果我尝试手动安装软件包,也会发生同样的情况:
> python setup.py install
running build_ext
building 'dulwich._objects' extension
error: Unable to find vcvarsall.bat
我尝试安装Python包dulwich:
pip install dulwich
但我收到了一条神秘的错误消息:
error: Unable to find vcvarsall.bat
如果我尝试手动安装软件包,也会发生同样的情况:
> python setup.py install
running build_ext
building 'dulwich._objects' extension
error: Unable to find vcvarsall.bat
当前回答
我尝试了以上所有答案,但发现所有答案都不起作用,这可能是因为我使用的是Windows 8,并且安装了Visual Studio 2012。在这种情况下,这就是你要做的。
vcvarsall.bat文件位于此处:C: \Program Files(x86)\Microsoft Visual Studio 11.0\VC
只需选择文件并复制它。
然后转到以下目录:C: \Program Files(x86)\Microsoft Visual Studio 11.0\Common7\Tools
并粘贴文件。然后,一切都会好起来。
其他回答
我不知道是否为时已晚,但我找到了Microsoft Visual C++Compiler for Python 2.7,该版本
如果需要此编译器包,您将收到的典型错误消息是Unable to find vcvarsall.bat
希望这有帮助!
我找到了解决方案。我也遇到了同样的问题和错误,安装“amara”。我安装了mingw32,但需要配置distutils。
我已经安装了Python 2.6。我将mingw32安装到C:\programs\mingw\将mingw32的bin目录添加到环境变量:append c:\programs\MinGW\bin;到PATH将位于C:\Python26\Lib\distutils\distutils.cfg的distutils.cfg文件编辑为:[生成]编译器=mingw32现在运行easy_install.exe amara。
确保通过打开新的cmd.exe来设置环境。
我没有看到任何使用vswhere的答案,我认为这是自Visual Studio 15.2以来正确的方法。
下面是我运行vsvars64.bat的方法(我想这与vsvarsall类似)
def init_vsvars():
cprint("")
cprint_header("Initializing vs vars")
vswhere_path = r"%ProgramFiles(x86)%/Microsoft Visual Studio/Installer/vswhere.exe"
vswhere_path = path.expandvars(vswhere_path)
if not path.exists(vswhere_path):
raise EnvironmentError("vswhere.exe not found at: %s", vswhere_path)
vs_path = common.run_process(".", vswhere_path,
["-latest", "-property", "installationPath"])
vs_path = vs_path.rstrip()
vsvars_path = os.path.join(vs_path, "VC/Auxiliary/Build/vcvars64.bat")
# common.run_process(".", vsvars_path, [])
os.system('"%s"' % vsvars_path)
run_process做了很多事情,但基本上归结为:
output = ""
process = subprocess.Popen(
commandline,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True)
for stdout_line in iter(process.stdout.readline, ""):
cprint(stdout_line)
output += stdout_line
process.stdout.close()
return_code = process.wait()
return output
当我尝试在windows 10中安装panda时,也出现了同样的错误。在搜索了几个解决方案后,我最终使用了轮子。
首先,将pip升级到最新版本:
easy_install install -U pip
第二,安装车轮:
pip install wheel
第三,下载软件包的whl文件并安装:
pip install [xxx].whl
到目前为止,我认为wheel是在windows上安装Python包的最佳方式。
看起来它正在寻找VC编译器,所以您可以尝试使用-c mingw32提及编译器类型,因为您有msys
python setup.py install -c mingw32