1

I build libyaml and install it into a local area:

yaml-0.1.5 $ ./configure --prefix=/usr/local/sqlminus
yaml-0.1.5 $ make install

yaml-0.1.5 $ ls -l /usr/local/sqlminus/include/yaml.h
-rw-r--r--@ 1 mh admin 54225 Jan 5 09:05 /usr/local/sqlminus/include/yaml.h

But when I build PyYAML, it cannot find yaml.h.

PyYAML-3.11 $ /usr/local/sqlminus/bin/python setup.py build

checking if libyaml is compilable
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall 
    -Wstrict-prototypes -I/usr/local/sqlminus/include/python2.7
-c build/temp.macosx-10.4-x86_64-2.7/check_libyaml.c
-o build/temp.macosx-10.4-x86_64-2.7/check_libyaml.o
build/temp.macosx-10.4-x86_64-2.7/check_libyaml.c:2:10:
fatal error: 'yaml.h'
      file not found
#include <yaml.h>
         ^
1 error generated.

How can I tell PyYAML where I've installed libyaml?

Mark Harrison
  • 297,451
  • 125
  • 333
  • 465

2 Answers2

2

(update) Based on dotslash's comment below, editing setup.cfg and adding these two lines made everything work smoothly.

include_dirs=/usr/local/sqlminus/include
library_dirs=/usr/local/sqlminus/lib

(end update)

I think you should install dependencies.

If you are using Ubuntu or Debian based system, you could search by this

apt-cache search libyaml

Then you may find there are some packages related.

I would suggest you try to install this: apt-get install libyaml-dev -y

If you are using Mac OS, you could change the source in file check_libyaml.c, tell it what the absolute path of yaml.h is.

Or just specify the path while compiling

python setup.py config --with-includepath=/path/to/your/install/of/python/includes/

Then go compiling.

More info can be found here.

Hope this be helpful.

Community
  • 1
  • 1
dotslash
  • 387
  • 5
  • 13
  • hmm, looks like the PyYAML setup.py doesn't have a config command. Otherwise that would be exactly what I need! – Mark Harrison Jan 05 '16 at 17:32
  • I think you should create a file **_setup.cfg_** in that folder if it's not there. More info [here](http://stackoverflow.com/questions/27077355/how-to-use-setup-cfg-instead-of-setup-py-with-python-2-7) – dotslash Jan 05 '16 at 17:46
  • perfect, I added this to your answer and accepted it. – Mark Harrison Jan 22 '16 at 20:13
0

Based on dotslash's comment, editing setup.cfg and adding these two lines made everything work smoothly:

include_dirs=/usr/local/sqlminus/include
library_dirs=/usr/local/sqlminus/lib
Mark Harrison
  • 297,451
  • 125
  • 333
  • 465