我尝试安装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
当前回答
也许有人会感兴趣,下面的内容适用于py2exe包。(我有windows 7 64位和可移植python 2.7,Visual Studio 2005 Express以及windows 7和.NET Framework 4的windows SDK)
set VS90COMNTOOLS=%VS80COMNTOOLS%
那么:
python.exe setup.py install
其他回答
我想在Windows 10上使用Python 2.7运行pysph,但没有找到vcvarsall.bat(来自distutils)
我的解决方案如下:
安装Microsoft Visual C++for Python 2.7(如@Michael建议的那样)
在Windows 10上,它安装到(我的用户名是Andreas):
C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0
将环境变量VS90COMNTOOLS设置为Visual C++for Python 2.7的安装路径(请参见上面的路径)。
如果仍然不起作用,则在模块中进行修改
C:/Python27/lib/distutils
文件msvc9compiler.py。在其中查找函数Find_vcvarsall并执行以下修改。
更换管路:
productdir = os.path.join(toolsdir, os.pardir, os.pardir, "VC")
with
productdir = os.path.join(toolsdir)
在我的案例中,这就是vcvarsall.bat所在的位置(请检查,vcvarsall.bat在您的安装中)。
你可以用easy_install代替pip,这对我很有用。
我找到了一个更简单的方法。只需从网站下载二进制文件包:http://www.lfd.uci.edu/~gohlke/pythonlibs'例如:autopy3‑0.51.1‑cp36‑cp36m‑win32.whl(cp36表示Python 3.6)下载它并通过pip安装文件的位置
看起来它正在寻找VC编译器,所以您可以尝试使用-c mingw32提及编译器类型,因为您有msys
python setup.py install -c mingw32
我找到了解决方案。我也遇到了同样的问题和错误,安装“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来设置环境。