嘿,我已经看过了这里的老问题,但它没有回答我的问题
我已经安装了libpng,然后尝试安装autopy并得到编译错误。
我对python还不是很在行,所以我不知道如何修复它们。
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有人能帮上忙吗。我需要自动测试,因为它可以在多个平台上工作
我使用ethan.tira-thompson.com/Mac_OS_X_Ports.html安装libpng
还安装了xcode和命令行工具
发布于 2012-10-31 11:04:59
我也有同样的问题,如果你注意到所有9个错误都来自一个文件:src/creengrab.c这个文件还没有更新到最新版本的OpenGL,并且有一些不推荐使用的方法。在autopy github存储库上,报告了此here.的错误修复/黑客建议添加行:#include <OpenGL/gl.h>
在src/screengrab.c中的第7行之后。你必须从Github获取源代码,并在本地修改它,而不是使用easy_install。
请注意,这是一个黑客攻击,可以让它编译,但屏幕抓取将是全黑的。有人需要花几分钟用最新的方法重写screengrab.c。
发布于 2014-09-05 17:52:16
当我添加
#include <OpenGL/gl.h>它没有编译。
因此,我查看了一下我的硬盘,寻找每个gl.h
所以,我试着
#include "/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/gl.h"然后我设法编译了它:-)
发布于 2012-10-21 06:12:17
如果您尝试过以下操作:
$ sudo easy_install自动生成
另一种选择是从GitHub存储库上的最新源代码编译:
$ git克隆git://github.com/msanders/autopy.git
$ cd自动复制
$ python setup.py内部版本
$ python setup.py安装
当从源代码构建时,在尝试使用autopy之前,请确保在自动生成目录中使用cd,否则可能会因为Python的相对导入而在ImportError上失败。
https://stackoverflow.com/questions/12993126
复制相似问题