Python 在OS X上构建pypoker评估时出错

Python 在OS X上构建pypoker评估时出错,python,macos,installation,Python,Macos,Installation,我想在我的Mac上安装pypoker eval。起初我遇到了这样的错误: Hector:pypoker-eval root# python setup.py install running install running build running build_ext building '_pokereval_2_7' extension cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pi

我想在我的Mac上安装pypoker eval。起初我遇到了这样的错误:

Hector:pypoker-eval root# python setup.py install
running install
running build
running build_ext
building '_pokereval_2_7' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPYTHON_VERSION="2_7" -DVERSION_NAME(w)=w ## 2_7 -Iinclude -I/usr/include/poker-eval -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pypokereval.c -o build/temp.macosx-10.10-intel-2.7/pypokereval.o
pypokereval.c:51:10: fatal error: 'poker_defs.h' file not found
#include "poker_defs.h"
         ^
1 error generated.
error: command 'cc' failed with exit status 1
Hector:pypoker-eval root# python setup.py install
running install
running build
running build_ext
building '_pokereval_2_7' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPYTHON_VERSION="2_7" -DVERSION_NAME(w)=w ## 2_7 -Iinclude -I/usr/include/poker-eval -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pypokereval.c -o build/temp.macosx-10.10-intel-2.7/pypokereval.o
pypokereval.c:462:35: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
      [-Wshorten-64-to-32]
  valid_cards_size = cards_size = PyList_Size(object);
                                ~ ^~~~~~~~~~~~~~~~~~~
pypokereval.c:484:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
      card = PyInt_AsLong(pycard);
           ~ ^~~~~~~~~~~~~~~~~~~~
pypokereval.c:996:18: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
      [-Wshorten-64-to-32]
  pockets_size = PyList_Size(pypockets);
               ~ ^~~~~~~~~~~~~~~~~~~~~~
pypokereval.c:1010:43: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        numToDeal[i + 1] = PyList_Size(pypocket) - count;
                         ~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
pypokereval.c:1022:43: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
      numToDeal[0] = PyList_Size(pyboard) - count;
                   ~ ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
5 warnings generated.
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.10-intel-2.7/pypokereval.o -lpoker-eval -o build/lib.macosx-10.10-intel-2.7/_pokereval_2_7.so
ld: library not found for -lpoker-eval
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
因此,我安装了poker eval并将C_INCLUDE_路径设置为/usr/local/INCLUDE/poker eval,它现在包含我安装的poker eval代码

现在,安装给了我以下错误:

Hector:pypoker-eval root# python setup.py install
running install
running build
running build_ext
building '_pokereval_2_7' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPYTHON_VERSION="2_7" -DVERSION_NAME(w)=w ## 2_7 -Iinclude -I/usr/include/poker-eval -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pypokereval.c -o build/temp.macosx-10.10-intel-2.7/pypokereval.o
pypokereval.c:51:10: fatal error: 'poker_defs.h' file not found
#include "poker_defs.h"
         ^
1 error generated.
error: command 'cc' failed with exit status 1
Hector:pypoker-eval root# python setup.py install
running install
running build
running build_ext
building '_pokereval_2_7' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPYTHON_VERSION="2_7" -DVERSION_NAME(w)=w ## 2_7 -Iinclude -I/usr/include/poker-eval -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pypokereval.c -o build/temp.macosx-10.10-intel-2.7/pypokereval.o
pypokereval.c:462:35: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
      [-Wshorten-64-to-32]
  valid_cards_size = cards_size = PyList_Size(object);
                                ~ ^~~~~~~~~~~~~~~~~~~
pypokereval.c:484:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
      card = PyInt_AsLong(pycard);
           ~ ^~~~~~~~~~~~~~~~~~~~
pypokereval.c:996:18: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
      [-Wshorten-64-to-32]
  pockets_size = PyList_Size(pypockets);
               ~ ^~~~~~~~~~~~~~~~~~~~~~
pypokereval.c:1010:43: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        numToDeal[i + 1] = PyList_Size(pypocket) - count;
                         ~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
pypokereval.c:1022:43: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
      numToDeal[0] = PyList_Size(pyboard) - count;
                   ~ ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
5 warnings generated.
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.10-intel-2.7/pypokereval.o -lpoker-eval -o build/lib.macosx-10.10-intel-2.7/_pokereval_2_7.so
ld: library not found for -lpoker-eval
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1

对于下一步该做什么,我没有主意了。有什么建议吗?

好的,我已经回答了我自己的问题:库路径需要设置为/usr/local/lib

完成后,我获得了python setup.py安装的以下输出。这些警告似乎没有问题,因为python test.py没有产生任何错误

Hector:pypoker-eval root# python setup.py install
running install
running build
running build_ext
building '_pokereval_2_7' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPYTHON_VERSION="2_7" -DVERSION_NAME(w)=w ## 2_7 -Iinclude -I/usr/include/poker-eval -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pypokereval.c -o build/temp.macosx-10.10-intel-2.7/pypokereval.o
pypokereval.c:462:35: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
      [-Wshorten-64-to-32]
  valid_cards_size = cards_size = PyList_Size(object);
                                ~ ^~~~~~~~~~~~~~~~~~~
pypokereval.c:484:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
      card = PyInt_AsLong(pycard);
           ~ ^~~~~~~~~~~~~~~~~~~~
pypokereval.c:996:18: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
      [-Wshorten-64-to-32]
  pockets_size = PyList_Size(pypockets);
               ~ ^~~~~~~~~~~~~~~~~~~~~~
pypokereval.c:1010:43: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        numToDeal[i + 1] = PyList_Size(pypocket) - count;
                         ~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
pypokereval.c:1022:43: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
      numToDeal[0] = PyList_Size(pyboard) - count;
                   ~ ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
5 warnings generated.
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.10-intel-2.7/pypokereval.o -lpoker-eval -o build/lib.macosx-10.10-intel-2.7/_pokereval_2_7.so
ld: warning: ignoring file /usr/local/lib/libpoker-eval.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libpoker-eval.dylib
running install_lib
copying build/lib.macosx-10.10-intel-2.7/_pokereval_2_7.so -> /Library/Python/2.7/site-packages
running install_egg_info
Writing /Library/Python/2.7/site-packages/pokereval-1.38-py2.7.egg-info