Search code examples
python-2.7pipswig

pip can't install package because it can't find swig2.0 binary


I'm using python 2.7.9 (64 bit) with pip 1.5.6 and virtualenv 12.1.1 on Windows 7 powershell. I created a virtual environment named NeuralNetwork and I'm trying to install the package fann2 1.0.7:

PS C:\Python27\envs\NeuralNetwork\Scripts> pip.exe install fann2
Collecting fann2
(...)
Exception: Couldn't find swig2.0 binary!

I guess I have to install this swig2.0 binary for Windows 7, but I can't figure out how exacly. I went to a swig site I found on Google and downloaded swigwin 2.0.12. The zip file came with a pre-compiled swig.exe. I read the documentation for Windows, but I didn't understand where should I put this file nor how to proceed afterward. I'm new to python and I've never heard of swig before. Could someone please help me?


Solution

  • I discovered what the problem was: swig.exe wasn't in Windows PATH variable. To fix this:

    1. Unzip swigwin wherever you want.
    2. Add the directory path where swig.exeis located to the Windows PATH variable.

    To add swig.exe directory to the PATH variable:

    1. Start the System Control Panel applet (Start - Settings - Control Panel - System).
    2. Select the Advanced tab.
    3. Click the Environment Variables button.
    4. Under System Variables, select Path, then click Edit.
    5. Put a ; and append the directory path where swig.exeis located to the end of the strig.