I use this command for installing MySQL client:
pip install mysqlclient
And then I see this problem:
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279
Cleaning up... Command C:\Python34\python.exe -c "import setuptools,
tokenize;file='C:\Users\Jayed\AppData\Local\Temp\pip_build_Jayed\mysqlclient\setup.py';exec(compile(getattr(tokenize,
'open', open)(file).read().replace('\r\n', '\n'), file,
'exec'))" install --record
C:\Users\Jayed\AppData\Local\Temp\pip-l4c6dhkk-record\install-record.txt
--single-version-externally-managed --compile failed with error code 1 in C:\Users\Jayed\AppData\Local\Temp\pip_build_Jayed\mysqlclient
Storing debug log for failure in C:\Users\Jayed\pip\pip.log
Actually I went down this path. While I suppose you can find all the libraries and components you need to get the client to compile, it is telling you it can't find a compiled copy of the client and is trying to compile it to install it.
Follow the instructions here: https://pypi.org/project/mysqlclient/ (it has notes about windows doing what you are describing) or download the wheel file (from downloads link on the page) and type
pip install mysqlclient.whl
and it will install without demanding C++ in order to use mysql with python.
Related
In my Python 3.8.6 project, I have installed "pip install SpeechRecognition" for my windows 10 computer. And the code sample is below,
import speech_recognition as sr
listener = sr.Recognizer()
try:
with sr.Microphone() as source:
print('Listening...')
voice = listener.listen(source)
command = listener.recognize_google(voice)
print(command)
except:
print("Something else went wrong")
pass
After run this code, output is below,
Something else went wrong
I have already microphone build-in with my laptop and also I have checked it also using plug an external USB microphone. Then what is the problem in here? Is there need any hardware configuration to solve this issue?
In the Speech Recognition Readme on PyPI, you can see there is a PyAudio Section. It means you have to have PyAudio Installed on your machine. But if you have PyAudio intsalled and you get an error, you need to share the error without the try except blocks, so we can analyze the error and give a solution.
To install PyAudio, execute pip install pyaudio in the terminal.
Sometimes pip install pyaudio can throw an error similar to this:
Collecting PyAudio
Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Installing collected packages: PyAudio
Running setup.py install for PyAudio ... error
Complete output from command C:\Users\username\AppData\Local\Programs\Python\Python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-e5le61j0\\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\username\AppData\Local\Temp\pip-record-adj3zivl\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
copying src\pyaudio.py -> build\lib.win32-3.7
running build_ext
building '_portaudio' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
----------------------------------------
Command "C:\Users\username\AppData\Local\Programs\Python\Python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-e5le61j0\\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\username\AppData\Local\Temp\pip-record-adj3zivl\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\username\AppData\Local\Temp\pip-install-e5le61j0\PyAudio\
Steps to fix this error:
Go to your terminal and execute python --version and in the case of Optimus Prime, his version is Python 3.8.6
Find if your Python Installation is 64 bit or 32 bit which you can see by going to your Python Terminal
Download a PyAudio Wheel file based on your Python version and your Python installation (64 bit / 32 bit)
Open up a Terminal in the directory where you have downloaded the Wheel File (.whl)
Then execute pip install <name of your wheel file>
And you are done!
I am trying to install pyodbc, and I am getting the below error.
C:\Python\Python37\Scripts>pip3 install pyodbc
Output
Collecting pyodbc
Using cached https://files.pythonhosted.org/packages/aa/71/cef225c4889620a1a00251d24c1746fe0cf4124290a75d1c2dc5c187b61f/pyodbc-4.0.23.tar.gz
Installing collected packages: pyodbc
Running setup.py install for pyodbc ... error
Complete output from command c:\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Alankar\\AppData\\Local\\Temp\\pip-install-7qf14pkz\\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\Alankar\AppData\Local\Temp\pip-record-k11gmg0x\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'pyodbc' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
Command "c:\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Alankar\\AppData\\Local\\Temp\\pip-install-7qf14pkz\\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\Alankar\AppData\Local\Temp\pip-record-k11gmg0x\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Alankar\AppData\Local\Temp\pip-install-7qf14pkz\pyodbc\
I couldn't get the C++ build tools method to work, but I found this method to be very straightforward:
Download the relevant pyodbc wheel (pre-compiled binary) based on your computer's architecture and version of Python: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyodbc
Run pip install <wheel path>.
For example:
pip install c:\users\bob\downloads\pyodbc-4.0.27-cp38-cp38-win_amd64.whl
Some Libraries require C++ build tools to install. In your case, to solve this problem there are two methods which are:
Update the pip's Setup tool:
To fix your error update the setup tool by this command:
pip install --upgrade setuptools
And the second method is to:
Install the Microsoft Visual C++ Build Tools
This can also be fixed by installing this little tool provided by Microsoft:
https://visualstudio.microsoft.com/visual-cpp-build-tools/
the install failed on my machine even after I installed Microsoft VC++ build tools, my solution for this is install an early version. the newer version assume you have VC++ and VS 2019 installed.
run this command
pip install -Iv pyodbc==4.0.27
If none of the other answers work:
I was running the newest version of python and it was giving me this error.
As soon as I downgraded to 3.8.x it worked like a charm using pip install
Here is the environment:
OS:windows 10
Django:2.0rc
Python:3.6
pip:10.0.0
visual studio community 2017
And the error message:
running build_ext
building 'twisted.test.raiser' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
Command "c:\users\airy\appdata\local\programs\python\python36\python.exe -u -c "import setuptools,
tokenize;__file__='C:\\Users\\Airy\\AppData\\Local\\Temp\\pip-install-0a1gjuaj\\twisted\\
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\Airy\AppData\Local\Temp
\pip-record-k1vjz5aa\install-record.txt --single-version-externally-managed
--compile" failed with error code 1 in C:\Users\Airy\AppData\Local\Temp\pip-install-0a1gjuaj\twisted\
I have already installed the build tools following the link description but it still doesn't work. If someone has solved it, please tell me how to fixed it.
Download twisted from this link.
Downloading Twisted‑18.4.0‑cp36‑cp36m‑win32.whl worked for me because I'm using Python 3.6. Download the version according to the python that you use.
After you download Twisted from the given link, open up a cmd where the file is located and run pip install Twisted‑18.4.0‑cp36‑cp36m‑win32.whl. pip will install Twisted from this file.
If you're doing it in a virtualenv, activate the virtualenv and install Twisted after that in the same process.
After that, you'll be able to install channels or whatever.
if you followed the instructions as mention by #rahim.nagori and encounter the problem as mention by #DiptangsuGoswami. just download the 32bit version of twisted or 64bit (if what you used previously was 32bit). it worked for me!
I am new to the Wagtail cms and am taking over a friend's project for his site.
I have downloaded his repo and am trying to get it to run locally. I have followed the steps on the wagtail documentation http://docs.wagtail.io/en/v1.12.1/getting_started/index.html
but in the site's requirements.txt file, there are some dependencies that just are not installing and giving errors:
here is the output of when trying to install the requirements:
build\lib.win32-2.7\psycopg2\_psycopg.pyd : fatal error LNK1120: 62 unresolved externals
error: command 'C:\\Users\\Adam\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\link.exe' failed with exit status 1120
Rolling back uninstall of psycopg2
Command "c:\python27\python.exe -u -c "import setuptools,
tokenize;__file__='c:\\users\\Adam\\appdata\\local\\temp\\pip-build-
bykm5e\\psycopg2\\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\Adam\appdata\local\temp\pip-
cidizd-record\install-record.txt --single-version-externally-managed --
compile" failed with error code 1 in c:\users\Adam\appdata\local\temp\pip-
build-bykm5e\psycopg2\
(The full output is here: https://pastebin.com/m1ukkei8)
Any help would be greatly appreciated - I am using Python 2.7 and have tried reinstalling psycopg and have installed postresql
Your windows linker is throwing out errors as you don't have c++ libraries for an extension to be built properly.
I would suggest to you to rather install it through wheel file
by running
pip install some-package.whl
I'm not sure if this is the answer, but the version of psycopg2 that you're using had a bug that prevented installation using pip, due to some bug in pip. Try version 2.5.3 and see if that fixes it.
I am using windows 8.1 64-bit with python 3.3. I have tried to execute easy_install pyodbc and pip install pyodbc each got different errors like below:
easy_install pyodbc:
C:\Python33>easy_install pyodbc
Searching for pyodbc
Reading https://pypi.python.org/simple/pyodbc/
Best match: pyodbc 3.0.10
Downloading
Processing pyodbc-3.0.10.tar.gz
Writing c:\users\chaith~1\appdata\local\temp\easy_install-s1q95y\pyodbc-3.0.10\s etup.cfg Running pyodbc-3.0.10\setup.py -q bdist_egg --dist-dir
c:\users\chaith~1\appdata\local\temp\easy_install-s1q95y\pyodbc-3.0.10\egg-dist-tmp-onfjbk
error: c:\users\chaith~1\appdata\local\temp\easy_install-s1q95y\pyodbc-3.0.10\py
odbc.egg-info\SOURCES.txt: The process cannot access the file because it is bein
g used by another process
pip install pyodbc :
C:\Python33>pip install pyodbc
Collecting pyodbc
Using cached pyodbc-3.0.10.tar.gz
Installing collected packages: pyodbc
Running setup.py install for pyodbc ... error
Complete output from command C:\Python33\python.exe -u -c "import setuptools
, tokenize;__file__='c:\\users\\chaith~1\\appdata\\local\\temp\\pip-build-8xaz3g
\\pyodbc\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read(
).replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\chaith~1\
appdata\local\temp\pip-xaf4bf-record\install-record.txt --single-version-externa
lly-managed --compile:
running install
running build
running build_ext
building 'pyodbc' extension
error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).
----------------------------------------
Command "C:\Python33\python.exe -u -c "import setuptools,
tokenize;__file__='c:\
\users\\chaith~1\\appdata\\local\\temp\\pip-build-8xaz3g\\pyodbc\\setup.py';exec
(compile(getattr(tokenize, 'open',
open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record c:\users\chaith~1\appdata\local\temp\pip-x
af4bf-record\install-record.txt --single-version-externally-managed
--compile" f ailed with error code 1 in c:\users\chaith~1\appdata\local\temp\pip-build-8xaz3g \pyodbc\
I have gone mad searching for the solutions. please help me it is very important for me to connect the sql server database with python
The way #thebjorn suggests solves the problem. More detail is found here: pyodbc requires python 3.3. I just used that method an houror so ago to install 64 bit pyobdc 3.0.10 with python 3.5.1 (for use with pydev running under Eclipse Mars.2) on 64-bit Win 7 Enterprise SP 1.
I ran across a seemingly intimidating exception thrown by the install process (I've documented it in that question) but pyobdc works and pip says it's installed.
BTW, Python 3.5.1 can be installed on Win 7, etc. without admin rights once Microsoft patch KB2999226 has been applied (but that does need admin rights).