19

I have some problems with python 3 module installing. I'm trying to install mysql using pip :

python -m pip install mysql

for python 3.4.4 and here is the error I get:

error: command 'C:\\Program Files (x86\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2

here is a screenshot : screenshot of the error message

I had other problems with module installation before, and I solved those by installing Visual Studio C++ 2010

Btw, the installation of other modules are working just fine.

My specs : Windows 10 x64

Python 3.4.4 x86

Marc Schmitt
  • 1,299
  • 3
  • 10
  • 7
  • Please provide the full error message! Like here (maybe, it is related http://stackoverflow.com/q/10773732/1566267) – John_West Apr 02 '16 at 19:30
  • Run this file in the command line (admin): `C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat` It will configure environment variables for using MSVC Compiler in command-line builds. – John_West Apr 02 '16 at 19:34
  • I added a screenshot of the full error message – Marc Schmitt Apr 02 '16 at 19:45
  • "Run this file in the command line (admin): C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat It will configure environment variables for using MSVC Compiler in command-line builds. " This didn't solve my problem – Marc Schmitt Apr 02 '16 at 19:47
  • Ok, then see that http://stackoverflow.com/q/26866147 – John_West Apr 02 '16 at 19:47
  • None of the answers in this post worked either :/ – Marc Schmitt Apr 02 '16 at 20:02
  • Do you have Connector installed? http://stackoverflow.com/a/16619567/ Download it here and install: http://dev.mysql.com/downloads/connector/c/6.0.html#downloads It can be due to you have x64 Win, but mysql wants files to be in "Program Files (x86)" dir: `mklink /d "C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" "C:\Program Files\MySQL\MySQL Connector C 6.0.2\include"` If won't help, try other answers from that post: http://stackoverflow.com/q/1972259 – John_West Apr 02 '16 at 20:16
  • Thanks a lot ! installing connector solved my problem ! – Marc Schmitt Apr 02 '16 at 20:40
  • I'm voting to close this question as off-topic because the solution was provided in the comments. – Roland Smith Jul 30 '17 at 08:02
  • @John_West please post as answer since it fixed the problem. – jmoon Aug 03 '17 at 22:56

4 Answers4

1

Do you have Connector installed? (See also here)

Download it here and install.

It can be due to you have x64 Windows, but mysql wants files to be in "Program Files (x86)" directory:

mklink /d "C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" "C:\Program Files\MySQL\MySQL Connector C 6.0.2\include"

If won't help, try other answers from that post

John_West
  • 2,239
  • 4
  • 24
  • 44
1

I had this problem and I can solve it in PyCharm (version: 2019.2) as follow:

  1. update the pip version in pycharm (at this time the latest version of pip is 20.0.2):

    1-1- Open project settings (File > Settings...) (preferences on Mac)

    1-2- Project > Project Interpreter

    1-3- Press the + button

    1-4- Type pip in the top search box

    1-5- In the lower right corner choose specify version and ensure using latest version

    1-6- press Install Package button

you can also find out the current version of pip through cmd in windows by this command: pip -V and then update pip by this command: pip install --upgrade pip

2- Go to File > Settings... > Project > Project:Interpreter and update pip by clicking on upgrade button as the following picture (click on the small upward arrow at the right sidebar): enter image description here

3- Like the first step, install latest version of matplotlib (at this time its latest version is 3.2)

Hosein Aqajani
  • 1,553
  • 4
  • 26
  • 46
0

Go to this site and download whl file (for example python3.7 and win64 should use mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl).

Then run this command:

python -m pip install C:\Users\%USER%\Desktop\mysqlclient-1.3.13-cp37-cp37m-win_amd64.whl
milos
  • 77
  • 3
  • 10
0

I was trying to install Pycocotools into my environment. I had the same error.

It got resolved by doing the following steps:

  1. Install Visual Studio 2019 which gives the paths C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.exe and C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.exe

  2. Go to Mask_RCNN, type cd Mask_RCNN

  3. In Anaconda Prompt, type pip install pycocotools

  4. Install Clone of COCO, type pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI

You'll get the following: enter image description here

  1. Open Jupyter notebook by typing jupyter notebook
miile7
  • 2,547
  • 3
  • 23
  • 38