"Unabletofindvcvarsall. bat" is displayed when pip is used to install lxml "?

Source: Internet
Author: User
I searched a lot on the Internet and said I needed to install vs2008. However, I installed vs2008 Professional Edition, but still the problem "Unabletofindvcvarsall. bat "and then, I downloaded and installed MinGW as I said on the internet, modified the environment variables and a series of other things, and finally the error turned into" TypeError: unorderabletypes: NoneType () & gt; str () "could you tell me how to solve this problem? I searched a lot on the Internet and said I needed to install vs2008. However, I installed vs2008 Professional Edition, but still the problem "Unable to find vcvarsall. bat"
Then, I downloaded and installed MinGW on the internet, modified the environment variables and other things. The final error turned into "TypeError: unorderable types: NoneType ()> = str ()"
How can this problem be solved? Reply content:

Just crawled out of this big pit:


1. Install wheel and run the following command:

pip install wheel
We recommend that you directly install the compiled installation package:
Http://www.lfd.uci.edu /~ Gohlke/pythonlibs/# lxml !!!! Python35 is not applicable to the following scenarios

---------- Original answer -----------
C:/Python31/Lib/distutils directory. The "unable to find vcvarsall. bat" statement is found in msvc9compiler. py.
The problem is that the python build version may be different from the version installed on your computer.
The specific modification code is as follows:
Msvc9compiler. py
Modify the MSVCCompiler function:
Vc_env = query_vcvarsall (VERSION, plat_spec)
Is:
If VS2014 is installed, VERSION 13.0 is used;
If VS2013 is installed, VERSION 12.0 is used;
If VS2012 is installed, VERSION 11.0 is used;
If VS2010 is installed, VERSION 10.0 is used;
If VS2008 is installed, VERSION is 9.0.
If I installed VS2013
Vc_env = query_vcvarsall (12.0, plat_spec)

On my computer, I checked that the VERSION is 10.0, that is, VS2010. Therefore, manual intervention is required, and modification does not affect the entire program, unless you change the VS version

As for the topic, version 2008 is useless. Because Python3.4 uses version 2010 by default, you can also directly download version 2010. This does not need to be changed. The following answers are not necessarily correct.

1. Download the pre-compiled binary installation package directly.

2. That stuff is in vc. I remember there was a vc version problem here. The file name seems to be different. You should go to the installation package and check which script is actually used, environment variables may not be added. Tip: this can be configured to use mingw. It is also configured in the installation script setup. py. If you have not done so, try to use mingw.

3. For linux, it is usually not a problem to use the Package Manager in the system. Simply press the binary package under the link given by @ cloak shining.

When python is installed with a c extension package through pip in windows, if python 2.7 is used, vs2008 is required. If python 3.xis used, vs2010 is required. if the version is incorrect, mingw cannot be used. This is because the c Runtime is incompatible.

There are two permanent solutions:
1. Change to linux
2. Use Anaconda Scientific Python Distribution

Cause:

Python3.4 is compiled by msvs2010, so python3.4 can only recognize msvs2010 by default.

Python2.7 is compiled by msvs2008, so python2.7 can only recognize msvs2008by default.

Method 1: Install mingw (not recommended)

Download the mingw environment and add Environment Variables

Or use

python setup.py build –compiler=mingw32
Thanks @ Xu Xian for your answer. Here I will add that to install the whl file, run cmd to go to python/Scripts /. Then run pip3.4 install xxxxx. whl (for version 3.4). It took a day to solve this problem! Basically, I tried all the methods on the internet, What registry, how to modify keytool, and how to install vs2010. Finally, I solved the problem through the python source code.

My python version is Python 3.5.

This problem occurs in the windows environment. python Setup needs to call a vcvarsall. bat file, which must be installed in the c ++ programming environment. There are two methods on the Internet: 1. Install MinGW; 2. Install Visual Studio. I am using the second method.

Step 1:

In the folder where your python program is located, find:"_ Msvccompiler. py"File, for example, the path strength in my computer is:

D: \ Program Files \ Anaconda3 \ Lib \ distutils \ _ msvccompiler. py

Find it and open it in the editor. Find the function declaration similar to "_ find_vcvarsall "."If version> =14And version> best_version :"Note "14" here. If 14 indicates that the VS version is later than 14. Therefore, we need to install the latest Visual Studio2015. (If it is 9 or above, then VS10 can be used for everything)


Step 2:

Currently, Visual Studio 2015 has a Community version and can be used for free. This version is enough. I put it on a cloud disk for your convenience. You can also download it from the official website.

Http://pan.baidu.com/s/1eSueWLG


After the download is complete, install:

Check the c ++ environment and XXXfor python. Web development should not be affected, but I also installed it because it is selected by default by the software.

In this step, there is a problem that has been stuck in "logging Your System, then we found the following solution on the Internet: (Visual Studio Express 2013 for windows with update 2 installation Taking Too much time in "processing ing Your System ")

This means that all processes of VS are shut down. It will take minutes after I turn off VS2015.

The openers of the Microsoft Community replied to this question. One sentence: for python, 3.4 install Windows SDK for Windows 7 and. NET 4.0 (Or Visual Studio 2010 ). For other versions, see the following table:

Self-built https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/ Well, if someone still sees this, try it like this:
Download the whl file according to the method of deep sea fish, rename it as zip, decompress it, and put it in the lib under the python installation directory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.