我在使用pip安装软件包时遇到问题 . 我在Windows 8.1 64位上运行Pyzo中的python 3.3(预先打包了numpy,scipy等) . 当我尝试使用pip安装需要编译一些c的软件包时,它会失败 .
起初我得到了错误"Unable to find vcvarsall.bat" . 我查了一下,似乎它试图找到用于构建我正在运行的python版本的编译器 .
error: Unable to find vcvarsall.bat
pip install gives error: Unable to find vcvarsall.bat
Unable to find VCVarsall.bat using Python 2.7
error: Unable to find vcvarsall.bat to compile python modules with Visual Studio 2008 installed
我正在为我的普通.Net运行Visual Studio 2013,但显然python 3.3是用Visual Studio 2010编译的 . 所以,我安装了Visual C 2010 express,但它仍然给出了同样的错误 .
我设法找到用于查找vcvarsall的源(lib / distutils中的msvc9compiler.py) . 所以我开始在源代码中探索,看到它寻找的版本是9.0(即Visual 2008) . 所以我下载了2008 C Express并再次尝试了 . 这次它找到了vcvarsall.bat,但我得到了一个不同的错误“ValueError:['path']”抛出错误的方法如下 . (我添加的打印件用于调试)
def query_vcvarsall(version, arch="x86"):
"""Launch vcvarsall.bat and read the settings from its environment
"""
vcvarsall = find_vcvarsall(version)
print(version)
print(arch)
print(vcvarsall)
interesting = set(("include", "lib", "libpath", "path"))
result = {}
if vcvarsall is None:
raise DistutilsPlatformError("Unable to find vcvarsall.bat")
log.debug("Calling 'vcvarsall.bat %s' (version=%s)", arch, version)
popen = subprocess.Popen('"%s" %s & set' % (vcvarsall, arch),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
try:
stdout, stderr = popen.communicate()
if popen.wait() != 0:
raise DistutilsPlatformError(stderr.decode("mbcs"))
stdout = stdout.decode("mbcs")
for line in stdout.split("\n"):
print(line)
line = Reg.convert_mbcs(line)
if '=' not in line:
continue
line = line.strip()
key, value = line.split('=', 1)
key = key.lower()
if key in interesting:
if value.endswith(os.pathsep):
value = value[:-1]
result[key] = removeDuplicates(value)
finally:
popen.stdout.close()
popen.stderr.close()
if len(result) != len(interesting):
print(str(result)+"::: "+str(interesting))
raise ValueError(str(list(result.keys())))
return result
所以基本上,正在发生的是它检查我的环境变量并查找有趣的条目(“包括”,“lib”,“libpath”,“路径”)现在,我所拥有的唯一一个是“ path“,所以最后的if语句抛出ValueError . 所以,我想知道的是其他人是什么,我为什么不拥有它们,为什么要找它们,我该如何解决?
感谢所有答案 .
问候
弗雷德里克
1 回答
问题是Visual C Express 2010不包含64位编译器 . 见How to compile a 64-bit application using Visual C++ 2010 Express .