After doing pip install pyaudio, It started collecting the package but suddenly it displayed this error. Hope the following explains what's going on:
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-b1kw0ltr\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-b1kw0ltr\\pyaudio\\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\mayank\AppData\Local\Temp\pip-record-s8qn1fa4\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\Include\pyaudio'
cwd: C:\Users\mayank\AppData\Local\Temp\pip-install-b1kw0ltr\pyaudio\
Complete output (15 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.8
copying src\pyaudio.py -> build\lib.win32-3.8
running build_ext
building '_portaudio' extension
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\mayank\AppData\Local\Programs\Python\Python38-32\include -IC:\Users\mayank\AppData\Local\Programs\Python\Python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.25.28610\include" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win32-3.8\Release\src/_portaudiomodule.obj
_portaudiomodule.c
src/_portaudiomodule.c(27): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-b1kw0ltr\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-b1kw0ltr\\pyaudio\\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\mayank\AppData\Local\Temp\pip-record-s8qn1fa4\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\Include\pyaudio' Check the logs for full command output.
brew install portaudio
Then:
brew link portaudio
pip install pyAudio
Or if you are using windows:
Go to: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
Download the file and then go to its directory in the cmd and type:
For win 32 bit:
pip install PyAudio‑0.2.11‑cp37‑cp37m‑win32.whl
For win 64 bit:
pip install PyAudio‑0.2.11‑cp38‑cp38‑win_amd64.whl
For windows-
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
press ctrl + f and search pyaudio and scroll down
Download any version of this if you are using 64 bit-
PyAudio‑0.2.11‑cp39‑cp39‑win_amd64.whl
or download any version of this if you are using 32 bit -
PyAudio‑0.2.11‑cp39‑cp39‑win32.whl
go to the file location of the downloaded file and press Shift + Right click
select open command window here
then copy the file name and paste like pip install "file name" for e.g-
pip install PyAudio‑0.2.11‑cp39‑cp39‑win_amd64.whl
If you are working on Ubunutu/Linux try below.
It worked for me
sudo apt-get install portaudio19-dev
pip install pyaudio
You have to download the pyAudio file manually and put it in a directory and cd to the same directory and run the given command.
I had the same issue and fixed it using pipwin:
pip install pipwin
pipwin install pyaudio
Related
This question already has answers here:
python pip on Windows - command 'cl.exe' failed
(9 answers)
Closed 3 years ago.
I am trying to install PyAudio on windows 10 but i am getting the following error. first it has given the error to install Microsoft Visual C++ Build Tools so i installed successfully. But now it showing following. Thanks
ERROR: Command errored out with exit status 1:
command: 'c:\users\nadeem\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\NADEEM\\AppData\\Local\\Temp\\pip-install-g79_tntp\\PyAudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\NADEEM\\AppData\\Local\\Temp\\pip-install-g79_tntp\\PyAudio\\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\NADEEM\AppData\Local\Temp\pip-record-_8egf72w\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\NADEEM\AppData\Local\Temp\pip-install-g79_tntp\PyAudio\
Complete output (13 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.8
copying src\pyaudio.py -> build\lib.win32-3.8
running build_ext
building '_portaudio' extension
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\src
cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\nadeem\appdata\local\programs\python\python38-32\include -Ic:\users\nadeem\appdata\local\programs\python\python38-32\include /Tcsrc/_portaudiomodule.c /Fobuild\temp.win32-3.8\Release\src/_portaudiomodule.obj
error: command 'cl.exe' failed: No such file or directory
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\nadeem\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\NADEEM\\AppData\\Local\\Temp\\pip-install-g79_tntp\\PyAudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\NADEEM\\AppData\\Local\\Temp\\pip-install-g79_tntp\\PyAudio\\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\NADEEM\AppData\Local\Temp\pip-record-_8egf72w\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
The pip install is trying to download and compile the library. Getting the Windows compilers are easier now, but can be a pain. https://wiki.python.org/moin/WindowsCompilers
Years ago when the compilers were a true pain to get Christoph Gohlke compiled and distributed the libraries for windows.
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
Download the .whl file for your python version and tell pip to install that file.
pip install ~/Downloads/PyAudio‑0.2.11‑cp36‑cp36m‑win_amd64.whl
I'm trying to install gmpy2 in a virtual environment in Windows 10.
Initially, I was getting the following error.
Collecting gmpy2
Using cached https://files.pythonhosted.org/packages/90/f4/9a2e384b325b69bc5827b9a6510a8fb4a51698c915c06a3f25a86458892a/gmpy2-2.0.8.zip
Installing collected packages: gmpy2
Running setup.py install for gmpy2: started
Running setup.py install for gmpy2: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'C:\Workspace\path\to\project\venv\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\setup.py'"'"'; __file__='"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\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\biles\AppData\Local\Temp\pip-record-p2f519dp\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Workspace\path\to\project\venv\include\site\python3.7\gmpy2'
cwd: C:\Users\biles\AppData\Local\Temp\pycharm-packaging\gmpy2\
Complete output (5 lines):
running install
running build
running build_ext
building 'gmpy2' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Workspace\path\to\project\venv\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\setup.py'"'"'; __file__='"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\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\biles\AppData\Local\Temp\pip-record-p2f519dp\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Workspace\path\to\project\venv\include\site\python3.7\gmpy2' Check the logs for full command output.
I was able to go past this error by installing the Build Tools for Visual Studio from https://visualstudio.microsoft.com/downloads/.
I tried again and this time I got the following error.
Collecting gmpy2
Using cached https://files.pythonhosted.org/packages/90/f4/9a2e384b325b69bc5827b9a6510a8fb4a51698c915c06a3f25a86458892a/gmpy2-2.0.8.zip
Installing collected packages: gmpy2
Running setup.py install for gmpy2: started
Running setup.py install for gmpy2: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'C:\Workspace\path\to\project\venv\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\setup.py'"'"'; __file__='"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\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\biles\AppData\Local\Temp\pip-record-i495p48z\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Workspace\path\to\project\venv\include\site\python3.7\gmpy2'
cwd: C:\Users\biles\AppData\Local\Temp\pycharm-packaging\gmpy2\
Complete output (12 lines):
running install
running build
running build_ext
building 'gmpy2' extension
creating build
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -DMPIR -DWITHMPFR -DWITHMPC -IC:\Workspace\path\to\project\venv\include -IC:\Users\biles\AppData\Local\Programs\Python\Python37-32\include -IC:\Users\biles\AppData\Local\Programs\Python\Python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc\gmpy2.c /Fobuild\temp.win32-3.7\Release\src\gmpy2.obj
gmpy2.c
C:\Users\biles\AppData\Local\Temp\pycharm-packaging\gmpy2\src\gmpy.h(104): fatal error C1083: Cannot open include file: 'mpir.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Workspace\path\to\project\venv\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\setup.py'"'"'; __file__='"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\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\biles\AppData\Local\Temp\pip-record-i495p48z\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Workspace\path\to\project\venv\include\site\python3.7\gmpy2' Check the logs for full command output.
I tried specifying the version to 2.1.0a4 and then to 2.1.0a2 and then to 2.0.8. But I got the same error.
Note: I'm trying to install this package through PyCharm Settings -> Project Interpreter.
Installing gmpy2 in Windows 10
Go to https://visualstudio.microsoft.com/downloads/ and download Build Tools for Visual Studio
Run the downloaded executable and install the latest libraries for C++
Go to https://www.lfd.uci.edu/~gohlke/pythonlibs/ and download the binaries for gmpy2 corresponding to your version of Python
Install the wheel using the below-mentioned command.
pip install C:\path\to\wheel\gmpy2-2.0.8-cp37-cp37m-win32.whl
Using these steps I was able to successfully install gmpy2 in my virtual environment. Please refer to the following screenshot.
Note: In my case it was gmpy2-2.0.8-cp37-cp37m-win32.whl because my project interpreter was Python 3.7. The cp37 in the filename means CPython 3.7. If you don't get the correct binaries, you'll get the following error.
gmpy2-2.0.8-cp38-cp38-win32.whl is not a supported wheel on this platform.
Thanks #keiv.fly :)
I'm getting error on pyodbc install, i was studyng the problem and maybe its the c++ redistribute instalation problem, but even with c++ redistribute intalation updated the problem oc
Follow the error when o try to install pyodbc
C:\Users\MacInBox>pip install pyodbc
Collecting pyodbc
Using cached https://files.pythonhosted.org/packages/75/29/aa190749bac37ede0f11a68a75e7055254699c11572bd94213f1163dfd8f/pyodbc-4.0.27.tar.gz
Installing collected packages: pyodbc
Running setup.py install for pyodbc ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\macinbox\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MacInBox\\AppData\\Local\\Temp\\pip-install-ysm4ul3_\\pyodbc\\setup.py'"'"'; __file__='"'"'C:\\Users\\MacInBox\\AppData\\Local\\Temp\\pip-install-ysm4ul3_\\pyodbc\\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\MacInBox\AppData\Local\Temp\pip-record-fzctfb9u\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\MacInBox\AppData\Local\Temp\pip-install-ysm4ul3_\pyodbc\
Complete output (12 lines):
running install
running build
running build_ext
building 'pyodbc' extension
creating build
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION=4.0.27 -Ic:\users\macinbox\appdata\local\programs\python\python38-32\include -Ic:\users\macinbox\appdata\local\programs\python\python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include" /EHsc /Tpsrc\buffer.cpp /Fobuild\temp.win32-3.8\Release\src\buffer.obj /Wall /wd4514 /wd4820 /wd4668 /wd4711 /wd4100 /wd4127 /wd4191
buffer.cpp
C:\Users\MacInBox\AppData\Local\Temp\pip-install-ysm4ul3_\pyodbc\src\pyodbc.h(19): fatal error C1083: NÆo ‚ poss¡vel abrir arquivo incluir: 'windows.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\macinbox\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MacInBox\\AppData\\Local\\Temp\\pip-install-ysm4ul3_\\pyodbc\\setup.py'"'"'; __file__='"'"'C:\\Users\\MacInBox\\AppData\\Local\\Temp\\pip-install-ysm4ul3_\\pyodbc\\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\MacInBox\AppData\Local\Temp\pip-record-fzctfb9u\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
Here are the c++ reditribute installed at my pc
Currently, pyodbc on PiPI (pyodbc 4.0.27) does not have wheel files for Python 3.8, so when you do pip install pyodbc pip will try to build pyodbc from source. You don't need C++ redistributables for that, you need a C++ compiler.
The next release of pyodbc will almost certainly have pre-compiled wheel files for Python 3.8. In the meantime you can download the required wheel file from
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyodbc
and then install it with
pip install C:\path\to\pyodbc-4.0.27-cp38-cp38-win32.whl
Update 2020-06-30: Current versions of pyodbc now have wheels for Python 3.8.
When installing pyaudio in the command prompt with:
python -m pip install pyaudio
I get an error:
ERROR: Complete output from command 'C:\python\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\admin\\AppData\\Local\\Temp\\pip-install-c823_6j8\\pyaudio\\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\admin\AppData\Local\Temp\pip-record-vkr4rksd\install-record.txt' --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
copying src\pyaudio.py -> build\lib.win-amd64-3.7
running build_ext
building '_portaudio' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command "'C:\python\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\admin\\AppData\\Local\\Temp\\pip-install-c823_6j8\\pyaudio\\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\admin\AppData\Local\Temp\pip-record-vkr4rksd\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\admin\AppData\Local\Temp\pip-install-c823_6j8\pyaudio\
You can simply grab the proper Wheel package for your current Python version from here
and then install it with pip install <PyAudio‑0.2.11-...>.whl. (remember to use full filename (e.g pip install PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl).
You don't need to download or any Microsoft Visual C++ Build Tools. Just do the following, it will be an ultimate fix:
After you go to this link: https://www.lfd.uci.edu/~gohlke/pythonlibs/ select and download the PyAudio for your Python version.
I downloaded:
PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
Place the downloaded file into the Scrips folder. My folder structure is:
`C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Scripts`
Then you need to install the downloaded script by using the command:
python -m pip install "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Scripts\PyAudio-0.2.11-cp37-cp37m-win_amd64.whl"
I'm trying to install zbar on my Windows x64 machine:
pip install zbar
And this is what I got:
Collecting zbar
Using cached zbar-0.10.tar.bz2
Installing collected packages: zbar
Running setup.py install for zbar ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\ruiyang\\appdata\\local\\temp\\pip-build-t2okcg\\zbar\\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\ruiyang\appdata\local\temp\pip-4pohzw-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'zbar' extension
creating build
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
C:\Users\Ruiyang\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\PC /Tczbarmodule.c /Fobuild\temp.win-amd64-2.7\Release\zbarmodule.obj
zbarmodule.c
c:\users\ruiyang\appdata\local\temp\pip-build-t2okcg\zbar\zbarmodule.h(26) : fatal error C1083: Cannot open include file: 'zbar.h': No such file or directory
error: command 'C:\\Users\\Ruiyang\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\ruiyang\\appdata\\local\\temp\\pip-build-t2okcg\\zbar\\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\ruiyang\appdata\local\temp\pip-4pohzw-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\ruiyang\appdata\local\temp\pip-build-t2okcg\zbar\
Anyone knows how to fix this problem?
You are trying to install zbar package with pip. When doing so, pip downloads the source and tries to compile the C/C++ source code of this project.
To do such a thing, you need a C/C++ compiler and having all dependencies. It may be complicated to have pip compiles this package.
The other solution is to download a binary wheel that embeds all binaries. zbar developers propose to download a binary wheel from their GitHub webpage
You can download this binary wheel, that targets a Windows Python 2.7 64 bit installation.
All you have to do is:
open a Windows cli with Windows+R and by running inside cmd
go to the directory where you have downloaded the whl file, with cd instructions
run pip install zbar-0.10-cp27-none-win_amd64.whl
For example, the command can be
pip install zbar-0.10-cp27-none-win_amd64.whl
If you have several Python installations, make sure to use the correct pip program.
You can do it for any package with some code that has to be compiled