0

My problem is not new and occurred to others with the same error (Unable to find vcvarsall.bat), while installing 'lxml'. I use Python 3.5 and windows 7. I tried to follow the recommended steps here but failed

  1. I installed mingw32 to C:\programs\mingw\

  2. Add mingw32's bin directory to your environment variable: append c:\programs\MinGW\bin; to the PATH

I went wrong here. May you explain me (simply) how to add mingw32's bin directory to the path?

  1. Edit (create if not existing) distutils.cfg file located at C:\Python35\Lib\distutils\distutils.cfg to be:

    [build]

    compiler=mingw32

I didn't get this step at all.

  1. Now run pip install lxml.

I got this one and I made sure the environment was set by opening a new cmd.exe.

Any advice to complete these steps would be greatly appreciated.

Community
  • 1
  • 1
emeryville
  • 332
  • 1
  • 4
  • 19
  • `vcvarsall.bat` is part of a different compiler, namely Microsoft's Visual C++ suite. To verify the path changes, open a terminal (hit Window+R, type cmd) and then run `echo %PATH%`. – Ulrich Eckhardt Dec 17 '15 at 07:27
  • `vcvarsall.bat` is related to Visual C++ compiler, not to MinGW (gcc). You probably update the wrong file when setting the compiler (`C:\Python26` does not look like a Python 3.5 directory!). – Holt Dec 17 '15 at 07:27
  • @Holt I tried to adapt this solution to Python 3.5. I edited the step. – emeryville Dec 17 '15 at 07:29
  • @emeryville You could try [this](http://stackoverflow.com/a/33618532/2666289), and if does not work, update your question with the new error (if it is new). – Holt Dec 17 '15 at 07:30
  • @UlrichEckhardt I ran `echo %PATH%` and I don't see anything related to MinGW – emeryville Dec 17 '15 at 07:34
  • 1
    @emeryville You could check [that page](http://www.lfd.uci.edu/~gohlke/pythonlibs/) which contains lots of precompiled Windows package for Python 2.7 / 3.4 / 3.5. In particular, you can find [lxml](http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml) - Simply download `lxml-3.5.0-cp35-none-win32.whl` (or the 64 bits version) and run `pip install lxml-3.5.0-cp35-none-win32.whl` (when in the correct folder). – Holt Dec 17 '15 at 07:36
  • 2
    I'd suggest using [anaconda](https://www.continuum.io) on windows. Setting up your env on Windows is a pain in the A. – mirosval Dec 17 '15 at 07:43
  • @mirosval Thanks. Is anaconda like RStudio for R (for which I am much more familiar!) ? – emeryville Dec 17 '15 at 07:47
  • @Holt Thanks. I will try. – emeryville Dec 17 '15 at 07:47
  • 2
    @emeryville not really, R Studio is an IDE, while Anaconda is a Python distribution, it will help you manage your Python, install, remove packages and so on, much easier than managing Python yourself. If you want an IDE, look up PyCharm – mirosval Dec 17 '15 at 07:51

2 Answers2

1

I think installing mingw32 is not a good idea. Please follow these setps:

  1. check your Python's versions, 3.4 will be easy to install;
  2. download the whl and use pip install command;
  3. go to http://www.lfd.uci.edu/~gohlke/pythonlibs/ where you'll find the file as your wish.
ain
  • 22,394
  • 3
  • 54
  • 74
lbg
  • 7
  • 1
1

I should install Microsoft Visual C++ Compiler for Python 2.7 from ... https://www.microsoft.com/en-us/download/confirmation.aspx?id=44266