我在使用pip安装包时遇到问题。我在Windows 8.1 64bit上运行pyzo 3.3(预先打包numpy,scipy等)。当我尝试安装需要编译一些c的pip包时,它会失败。使用pip安装时编译时出错
起初我收到错误“无法找到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
我在运行Visual Studio 2013为我普通的.Net的东西,但显然蟒蛇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
所以基本上,发生的是它检查我的环境变量并查找有趣的条目(“include”,“lib”,“libpath”,“path”) 现在,唯一一个我有“路径”,所以最终的if语句抛出ValueError。 所以,我想知道的是其他人是什么,为什么我没有他们,为什么要找他们,我该如何解决?
感谢所有的答案。
问候
弗雷德里克
它为拱打印什么? – jwalker
嗨,它打印'amd64'。 –