问题描述
嘿,我在这里看过一个老问题,但它不能回答我的问题
Hey I have looked at and old question here but it doesn't answer my question
我已经安装了libpng,然后尝试安装autopy并遇到compile错误.
I have installed libpng, then try to install autopy and get complie errors.
我还不太擅长python,所以我不确定如何修复它们.
I am not great at python yet so I am not sure on how to fix them.
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
任何人都可以帮忙.我需要autopy,因为它可以在多个平台上运行
Can anyone help. I need autopy as it works on multiple platforms
我使用ethan.tira-thompson.com/Mac_OS_X_Ports.html安装libpng
I used ethan.tira-thompson.com/Mac_OS_X_Ports.html to install libpng
还已通过命令行工具安装了xcode
Have xcode installed with command line tools as well
推荐答案
如果您发现所有9个错误都来自一个文件,则我遇到了同样的问题:src/screengrab.c该文件尚未更新为OpenGL的最新版本,并且有不赞成使用的方法.在autopy github存储库上,有一个关于此此处的错误.有添加行:#include <OpenGL/gl.h>
I had the same problem, if you notice all 9 errors are coming from one file:src/screengrab.cThis file has not been updated to the latest version of OpenGL and there are deprecated methods. On the autopy github repo there is a bug reported for this here. The fix/hack suggested there is to add the line:#include <OpenGL/gl.h>
src/screengrab.c中第7行之后.您将不得不从Github获取源代码并在本地更改它,而不是使用easy_install.
请注意,这是一种hack,可以对其进行编译,但屏幕抓图将全为黑色.有人需要花几分钟用最新的方法重写screengrab.c.
after line 7 in src/screengrab.c. You are going to have to get the source from Github and alter it locally rather than using easy_install.
Note this is a hack that will get it to compile but the screen grabs will be all black. Someone needs to spend a few minutes rewriting screengrab.c with up to date methods.
这篇关于安装python autopy时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!