python installed PIL module when Unable to find vcvarsall.bat error resolution

  • 2020-05-12 02:48:35
  • OfStack

Many of you may have encountered this error. When installing python2.7 image processing module PIL using setup.py, python will look for vs2008 installed on your computer by default. If you have not installed vs2008, it will appear Unable to find vcvarsall.bat Error.

So how do you fix this mistake? Here's how to fix this mistake.

You can direct python to identify a new vs by setting the VS90COMNTOOLS environment variable, and then execute setup.py to continue the installation.

If you have installed vs2010, execute it in cmd:


SET VS90COMNTOOLS=%VS100COMNTOOLS% 

If vs2012 is installed, execute in cmd:


SET VS90COMNTOOLS=%VS110COMNTOOLS% 

If you have installed vs2013, execute it in cmd:


SET VS90COMNTOOLS=%VS120COMNTOOLS% 

If you don't want to install VS because it's too big, you can install MinGW instead.

1. In the installation directory of MinGW, find the bin folder, find mingw32-make.exe, and make a copy of make.exe

2. Add the path of MinGW to the environment variable path. For example, if I install MinGW into D:\MinGW\, then add D:\MinGW\bin to path;

3, in < python installation directory > \distutils add file distutils.cfg, type in file:


[build] 
compiler=mingw32 

Save the file.

conclusion

The above is the solution of Unable to find vcvarsall when python installed PIL module. I hope it can help you in your study or work. If you have any questions, please leave a message to communicate.


Related articles: