天天看點

Python3 pip 解決問題: error: Unable to find vcvarsall.bat

當我給 python3.5 安裝 第三方庫

charset

時:

pip install charset

,出現了錯誤:

Python3 pip 解決問題: error: Unable to find vcvarsall.bat
D:\WorkSpace\python_ws\python-large-web-crawler\firstdemo>pip install charset
Collecting charset
  Downloading charset-1.0.1.tar.gz (189kB)
    100% |████████████████████████████████| 194kB 3.9kB/s
Collecting chardet (from charset)
  Using cached chardet-2.3.0.tar.gz
Installing collected packages: chardet, charset
  Running setup.py install for chardet ... done
  Running setup.py install for charset ... error
    Complete output from command c:\users\aobo\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\AOBO\\AppData\\Local\\Temp\\pip-build-ydv8oep3\\charset\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\AOBO\AppData\Local\Temp\pip-hlxpja30-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.5
    creating build\lib.win-amd64-3.5\charset
    copying charset\cmd.py -> build\lib.win-amd64-3.5\charset
    copying charset\__init__.py -> build\lib.win-amd64-3.5\charset
    running egg_info
    writing charset.egg-info\PKG-INFO
    writing top-level names to charset.egg-info\top_level.txt
    writing dependency_links to charset.egg-info\dependency_links.txt
    writing requirements to charset.egg-info\requires.txt
    writing entry points to charset.egg-info\entry_points.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'charset.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no files found matching '*.txt' under directory 'docs'
    warning: no files found matching '*.txt' under directory 'languagedet\data'
    warning: no files found matching '*.pickle' under directory 'languagedet\data'
    warning: no files found matching '*.conf' under directory 'languagedet\data'
    writing manifest file 'charset.egg-info\SOURCES.txt'
    running build_ext
    building 'charset.detector' extension
    error: Unable to find vcvarsall.bat

    ----------------------------------------
Command "c:\users\aobo\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\AOBO\\AppData\\Local\\Temp\\pip-build-ydv8oep3\\charset\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\AOBO\AppData\Local\Temp\pip-hlxpja30-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\AOBO\AppData\Local\Temp\pip-build-ydv8oep3\charset\
           

為什麼出現這個問題?

在指令行中執行:python,看看目前使用的python的版本,和它所需要的Vs軟體的編譯器的版本:

Python3 pip 解決問題: error: Unable to find vcvarsall.bat

目前python版本是:python3.5.0;目前需要的Vs編譯器的版本是:MSC v. 1900

檢視下面的表格,對于版本的Visual C ++使用的編譯器版本如下:(表的參考網站)

Visual C ++版本 編譯器版本
Visual C++ 4.x MSC_VER=1000
Visual C++ 5 MSC_VER=1100
Visual C++ 6 MSC_VER=1200
Visual C++ .NET MSC_VER=1300
Visual C++ .NET 2003 MSC_VER=1310
Visual C++ 2005 (8.0) MSC_VER=1400
Visual C++ 2008 (9.0) MSC_VER=1500
Visual C++ 2010 (10.0) MSC_VER=1600
Visual C++ 2012 (11.0) MSC_VER=1700
Visual C++ 2013 (12.0) MSC_VER=1800
Visual C++ 2015 (14.0) MSC_VER=1900

是以解決這個

error: Unable to find vcvarsall.bat

問題的方法就是:下載下傳并安裝 Visual Studio 2015 軟體,問題即可解決。

解決辦法 — 安裝:Python Tools 2.2.5 for Visual Studio 2015

Step 1 . 下載下傳 Visual Studio 2015 軟體。

下載下傳和安裝 Visual Studio 2015 軟體 的詳細步驟請到這個部落格檢視:下載下傳和安裝 Visual Studio 2015 軟體 的詳細步驟圖文教程。(我們按照這個網站的方法安裝VS2015,但不按照這個部落格裡面說的安裝。)

如果安裝上面的網站的方法安裝VS2015軟體,那麼問題還是不能解決。(

error: Unable to find vcvarsall.bat

Step 2 . 安裝 Visual Studio 2015 軟體

這個VS2015,安裝時需要選擇:自定義安裝。(參考網站)

參考網站:

Python3 pip 解決問題: error: Unable to find vcvarsall.bat
Python3 pip 解決問題: error: Unable to find vcvarsall.bat

我們的目的就是安裝這個軟體:Python Tools 2.2.5 for Visual Studio 2015 。現在,這個軟體已經安裝完了。

Python3 pip 解決問題: error: Unable to find vcvarsall.bat

注意:

如果一直停留在:“正在配置您的系統,這可能需要一些時間”

Python3 pip 解決問題: error: Unable to find vcvarsall.bat
解決:關掉VS的所有程序。

搞定,問題解決

現在再執行:

pip install charset

。問題解決。

Python3 pip 解決問題: error: Unable to find vcvarsall.bat