2012-10-20 18 views
7

Hej Mam spojrzał na starego i pytanie tutaj, ale to nie jest odpowiedź na moje pytanieBłędy podczas instalacji Pythona autopy

Mam zainstalowany libpng, a następnie spróbuj zainstalować autopy i pojawiają się błędy complie.

Nie jestem świetny w Pythonie, więc nie jestem pewien, jak je naprawić.

Ashley:~ ashleyhughes$ sudo easy_install autopy 
Searching for autopy 
Reading http://pypi.python.org/simple/autopy/ 
Reading http://www.autopy.org 
Best match: autopy 0.51 
Downloading http://pypi.python.org/packages/source/a/autopy/autopy-0.51.tar.gz#md5=b92055aa2a3712a9c3b4c874014b450e 
Processing autopy-0.51.tar.gz 
Running autopy-0.51/setup.py -q bdist_egg --dist-dir /tmp/easy_install-U9uWoj/autopy-0.51/egg-dist-tmp-hdjtIx 
clang: warning: argument unused during compilation: '-mno-fused-madd' 
clang: warning: argument unused during compilation: '-mno-fused-madd' 
clang: warning: argument unused during compilation: '-mno-fused-madd' 
clang: warning: argument unused during compilation: '-mno-fused-madd' 
clang: warning: argument unused during compilation: '-mno-fused-madd' 
src/screengrab.c:48:26: warning: implicit declaration of function 
     'CGDisplayBitsPerPixel' is invalid in C99 
     [-Wimplicit-function-declaration] 
     bitsPerPixel = (uint8_t)CGDisplayBitsPerPixel(displayID); 
           ^
src/screengrab.c:191:2: warning: 'CGLSetFullScreen' is deprecated 
     [-Wdeprecated-declarations] 
     CGLSetFullScreen(glContext); 
     ^
src/screengrab.c:194:2: warning: implicit declaration of function 'glReadBuffer' 
     is invalid in C99 [-Wimplicit-function-declaration] 
     glReadBuffer(GL_FRONT); 
     ^
src/screengrab.c:194:15: error: use of undeclared identifier 'GL_FRONT' 
     glReadBuffer(GL_FRONT); 
        ^
src/screengrab.c:197:2: warning: implicit declaration of function 'glFinish' is 
     invalid in C99 [-Wimplicit-function-declaration] 
     glFinish(); 
     ^
src/screengrab.c:199:6: warning: implicit declaration of function 'glGetError' 
     is invalid in C99 [-Wimplicit-function-declaration] 
     if (glGetError() != GL_NO_ERROR) return NULL; 
      ^
src/screengrab.c:199:22: error: use of undeclared identifier 'GL_NO_ERROR' 
     if (glGetError() != GL_NO_ERROR) return NULL; 
          ^
src/screengrab.c:207:2: warning: implicit declaration of function 
     'glPopClientAttrib' is invalid in C99 [-Wimplicit-function-declaration] 
     glPopClientAttrib(); /* Clear attributes previously set. */ 
     ^
src/screengrab.c:223:2: warning: implicit declaration of function 
     'glPushClientAttrib' is invalid in C99 [-Wimplicit-function-declaration] 
     glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); 
     ^
src/screengrab.c:223:21: error: use of undeclared identifier 
     'GL_CLIENT_PIXEL_STORE_BIT' 
     glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); 
         ^
src/screengrab.c:225:2: warning: implicit declaration of function 
     'glPixelStorei' is invalid in C99 [-Wimplicit-function-declaration] 
     glPixelStorei(GL_PACK_ALIGNMENT, BYTE_ALIGN); /* Force alignment. */ 
     ^
src/screengrab.c:225:16: error: use of undeclared identifier 'GL_PACK_ALIGNMENT' 
     glPixelStorei(GL_PACK_ALIGNMENT, BYTE_ALIGN); /* Force alignment. */ 
        ^
src/screengrab.c:226:16: error: use of undeclared identifier 
     'GL_PACK_ROW_LENGTH' 
     glPixelStorei(GL_PACK_ROW_LENGTH, 0); 
        ^
src/screengrab.c:227:16: error: use of undeclared identifier 'GL_PACK_SKIP_ROWS' 
     glPixelStorei(GL_PACK_SKIP_ROWS, 0); 
        ^
src/screengrab.c:228:16: error: use of undeclared identifier 
     'GL_PACK_SKIP_PIXELS' 
     glPixelStorei(GL_PACK_SKIP_PIXELS, 0); 
        ^
src/screengrab.c:235:2: warning: implicit declaration of function 'glReadPixels' 
     is invalid in C99 [-Wimplicit-function-declaration] 
     glReadPixels(x, y, width, height, 
     ^
src/screengrab.c:236:30: error: use of undeclared identifier 'GL_BGRA' 
        MMRGB_IS_BGR ? GL_BGRA : GL_RGBA, 
            ^
src/screengrab.c:236:40: error: use of undeclared identifier 'GL_RGBA' 
        MMRGB_IS_BGR ? GL_BGRA : GL_RGBA, 
              ^
9 warnings and 9 errors generated. 
error: Setup script exited with error: command 'clang' failed with exit status 1 

Czy ktoś może pomóc. Muszę autopy jak to działa na wielu platformach

użyłem ethan.tira-thompson.com/Mac_OS_X_Ports.html zainstalować libpng

Czy Xcode zainstalowany z narzędzi wiersza poleceń oraz

+0

w [edytuj] własne pytanie, aby dodać dodatkowe informacje. –

+1

Wygląda na to, że brakuje plików nagłówkowych OpenGL. Czy zainstalowałeś Xcode? –

+0

Tak, mam również xcode do zainstalowania narzędzi wiersza poleceń xcode, ponieważ brakowało klangu –

Odpowiedz

-3

Jeśli próbowałeś to:

$ sudo easy_install autopy

Inną opcją jest kompilacja z najnowszej źródła w repozytorium gitHub:

$ git clone git: //github.com/msanders/autopy.git

$ cd autopy

$ python setup.py budować

$ python setup.py zainstalować

Kiedy budowanie ze źródła, upewnij się, że zakończyłeś katalog autopy przed próbą użycia AutoPy, inaczej może się to nie udać w przypadku ImportError z powodu względnego importu Pythona.

+0

Próbowałem oba powyższe obie dał te same błędy –

11

Miałem ten sam problem, jeśli zauważysz wszystkie 9 błędów pochodzących z jednego pliku: src/screengrab.c Ten plik nie został zaktualizowany do najnowszej wersji OpenGL i istnieją nieaktualne metody. Na autopy github repo jest błąd zgłoszone do tego here. FIX/Hack sugerowane jest, aby dodać linię: #include <OpenGL/gl.h>

po linii 7 w src/screengrab.c. Będziesz musiał pobrać źródło z Github i zmienić je lokalnie, zamiast używać easy_install.
Uwaga: jest to hack, który doprowadzi do kompilacji, ale ekrany będą czarne. Ktoś musi poświęcić kilka minut na przepisanie screengrab.c przy użyciu aktualnych metod.

3

Kiedy dodałem

#include <OpenGL/gl.h> 

Nie skompilować.

Więc przyjrzał chociaż mój twardy dysk, szukając każdej gl.h

Więc starałem

#include "/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/gl.h" 

Potem udało mi się go skompilować :-)

Powiązane problemy