我尝试安装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
当前回答
我遵守了指示http://springflex.blogspot.ru/2014/02/how-to-fix-valueerror-when-trying-to.html.但什么都没发生。然后我安装了2010 Visual Studio Express(http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express)遵循建议http://blog.python.org/2012/05/recent-windows-changes-in-python-33.html它帮助了我
其他回答
如果您希望在未安装Visual Studio的Windows机箱上安装pyodbc,另一种选择是使用二进制发行版手动安装pyodcc。
如果您在正在使用的计算机上没有管理员权限,并且正在尝试设置virtualenv,则这特别有用。
步骤:
从这里下载最新的Windows安装程序(pyodbc-X.X.X.X.win-Y-py2.7.exe)使用7-Zip(或WinRAR等)打开安装程序可执行文件提取pyodbc.pyd和pyodbc-X.X-X-py2.7.egg-info,并将它们放在[python安装目录或virtualenv]\Lib\site包中没有步骤4:)
我没有看到任何使用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
2016年解决这一问题的最简单方法是安装Chocolatey,然后安装vcpython27包。打开Powershell:
> iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
> choco install python2 -y
> choco install vcpython27 -y
我也遇到了同样的问题,现在已经解决了。
“谷歌”告诉我,我需要安装“Microsoft Visual C++编译器Python 2.7版”。我不仅安装了该工具,还安装了Visual C++2008 Reditributable,但无济于事。然后我尝试安装Visual C++2008速成版。问题已经解决了!
只需尝试安装Visual C++2008速成版!
转到此处:http://docs.continuum.io/anaconda/install.html#windows-安装
有安装anaconda的说明,它将提供一个GUI和一个静默安装的大多数软件包,这些软件包似乎导致了这个问题http://www.scipy.org/.我知道2.7的解决方案https://www.microsoft.com/en-us/download/details.aspx?id=44266但我没有看到Python 3.4的选项。下载并安装Anaconda后,您应该能够从scipy导入所需的大部分软件包。
希望这能帮助一些人。我花了45分钟的时间来搜索帖子和网站。
编辑:我只想注意GUI页面上OS符号旁边有一个Python34链接。