为什么我不能安装autopy?
Why i can't install autopy?
我使用的是 MacBook,操作系统是 MacOS Sierra。
我使用这个命令来安装autopy:
sudo pip install autopy
但是我得到这个错误:
Collecting autopy
Downloading autopy-0.51.tar.gz (74kB)
100% |████████████████████████████████| 81kB 256kB/s
Installing collected packages: autopy
Running setup.py install for autopy ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-jSobWR/autopy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lxk785-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.12-intel-2.7
creating build/lib.macosx-10.12-intel-2.7/autopy
copying autopy/__init__.py -> build/lib.macosx-10.12-intel-2.7/autopy
running build_ext
building 'color' extension
creating build/temp.macosx-10.12-intel-2.7
creating build/temp.macosx-10.12-intel-2.7/src
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 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/autopy-color-module.c -o build/temp.macosx-10.12-intel-2.7/src/autopy-color-module.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
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 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/MMBitmap.c -o build/temp.macosx-10.12-intel-2.7/src/MMBitmap.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.12-intel-2.7/src/autopy-color-module.o build/temp.macosx-10.12-intel-2.7/src/MMBitmap.o -o build/lib.macosx-10.12-intel-2.7/autopy/color.so
building 'screen' 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 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/autopy-screen-module.c -o build/temp.macosx-10.12-intel-2.7/src/autopy-screen-module.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
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 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/screen.c -o build/temp.macosx-10.12-intel-2.7/src/screen.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
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 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/screengrab.c -o build/temp.macosx-10.12-intel-2.7/src/screengrab.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
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:174:15: warning: 'kCGLPFAFullScreen' is deprecated: first deprecated in macOS 10.6 [-Wdeprecated-declarations]
attribs[0] = kCGLPFAFullScreen;
^
/System/Library/Frameworks/OpenGL.framework/Headers/CGLTypes.h:98:2: note: 'kCGLPFAFullScreen' has been explicitly marked deprecated here
kCGLPFAFullScreen OPENGL_ENUM_DEPRECATED(10_0, 10_6) = 54,
^
src/screengrab.c:191:2: warning: 'CGLSetFullScreen' is deprecated: first deprecated in macOS 10.6 [-Wdeprecated-declarations]
CGLSetFullScreen(glContext);
^
/System/Library/Frameworks/OpenGL.framework/Headers/OpenGL.h:73:17: note: 'CGLSetFullScreen' has been explicitly marked deprecated here
extern CGLError CGLSetFullScreen(CGLContextObj ctx) OPENGL_DEPRECATED(10_0, 10_6);
^
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:240:15: error: use of undeclared identifier 'GL_UNSIGNED_INT_8_8_8_8_REV'
GL_UNSIGNED_INT_8_8_8_8_REV, /* Native format */
^
10 warnings and 9 errors generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-jSobWR/autopy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lxk785-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-jSobWR/autopy/
为什么我会收到这个错误?
有一个已知问题由于某种原因没有得到解决。
问题:https://github.com/msanders/autopy/issues/75
它包含以下解决方法(在控制台中键入命令):
brew install libpng
CFLAGS="-Wno-return-type" pip install git+https://github.com/potpath/autopy.git
一般来说,它工作起来很容易,但如果不工作,那就有点棘手了,您需要在终端上执行 运行 命令。
首先,通过 运行ning:
检查您的机器是否可以使用二进制轮
$ pip install -U autopy
如果失败,安装 rustup 然后 运行:
$ rustup default nightly-2019-10-05
$ pip install -U setuptools-rust
$ pip install -U autopy
有时 $ rustup default nightly-2019-10-05
由于所有软件包不可用而无法工作,运行 rustup install nightly 2019-10-05 --force
。但是您已确保正确安装了 rustup,因为它还需要安装 [BuildTools][2]
您必须使用 3.8 来安装 autopy。如果您不确定,请在您的终端中输入:
python --version
None 版本 python except 3.8 can install autopy.
查看其他版本的 autopy https://pypi.org/project/autopy/ .
谢谢。
我使用的是 MacBook,操作系统是 MacOS Sierra。
我使用这个命令来安装autopy:
sudo pip install autopy
但是我得到这个错误:
Collecting autopy
Downloading autopy-0.51.tar.gz (74kB)
100% |████████████████████████████████| 81kB 256kB/s
Installing collected packages: autopy
Running setup.py install for autopy ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-jSobWR/autopy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lxk785-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.12-intel-2.7
creating build/lib.macosx-10.12-intel-2.7/autopy
copying autopy/__init__.py -> build/lib.macosx-10.12-intel-2.7/autopy
running build_ext
building 'color' extension
creating build/temp.macosx-10.12-intel-2.7
creating build/temp.macosx-10.12-intel-2.7/src
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 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/autopy-color-module.c -o build/temp.macosx-10.12-intel-2.7/src/autopy-color-module.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
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 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/MMBitmap.c -o build/temp.macosx-10.12-intel-2.7/src/MMBitmap.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.12-intel-2.7/src/autopy-color-module.o build/temp.macosx-10.12-intel-2.7/src/MMBitmap.o -o build/lib.macosx-10.12-intel-2.7/autopy/color.so
building 'screen' 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 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/autopy-screen-module.c -o build/temp.macosx-10.12-intel-2.7/src/autopy-screen-module.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
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 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/screen.c -o build/temp.macosx-10.12-intel-2.7/src/screen.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
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 -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DIS_MACOSX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/screengrab.c -o build/temp.macosx-10.12-intel-2.7/src/screengrab.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
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:174:15: warning: 'kCGLPFAFullScreen' is deprecated: first deprecated in macOS 10.6 [-Wdeprecated-declarations]
attribs[0] = kCGLPFAFullScreen;
^
/System/Library/Frameworks/OpenGL.framework/Headers/CGLTypes.h:98:2: note: 'kCGLPFAFullScreen' has been explicitly marked deprecated here
kCGLPFAFullScreen OPENGL_ENUM_DEPRECATED(10_0, 10_6) = 54,
^
src/screengrab.c:191:2: warning: 'CGLSetFullScreen' is deprecated: first deprecated in macOS 10.6 [-Wdeprecated-declarations]
CGLSetFullScreen(glContext);
^
/System/Library/Frameworks/OpenGL.framework/Headers/OpenGL.h:73:17: note: 'CGLSetFullScreen' has been explicitly marked deprecated here
extern CGLError CGLSetFullScreen(CGLContextObj ctx) OPENGL_DEPRECATED(10_0, 10_6);
^
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:240:15: error: use of undeclared identifier 'GL_UNSIGNED_INT_8_8_8_8_REV'
GL_UNSIGNED_INT_8_8_8_8_REV, /* Native format */
^
10 warnings and 9 errors generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-jSobWR/autopy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lxk785-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-jSobWR/autopy/
为什么我会收到这个错误?
有一个已知问题由于某种原因没有得到解决。
问题:https://github.com/msanders/autopy/issues/75
它包含以下解决方法(在控制台中键入命令):
brew install libpng
CFLAGS="-Wno-return-type" pip install git+https://github.com/potpath/autopy.git
一般来说,它工作起来很容易,但如果不工作,那就有点棘手了,您需要在终端上执行 运行 命令。 首先,通过 运行ning:
检查您的机器是否可以使用二进制轮$ pip install -U autopy
如果失败,安装 rustup 然后 运行:
$ rustup default nightly-2019-10-05
$ pip install -U setuptools-rust
$ pip install -U autopy
有时 $ rustup default nightly-2019-10-05
由于所有软件包不可用而无法工作,运行 rustup install nightly 2019-10-05 --force
。但是您已确保正确安装了 rustup,因为它还需要安装 [BuildTools][2]
您必须使用 3.8 来安装 autopy。如果您不确定,请在您的终端中输入:
python --version
None 版本 python except 3.8 can install autopy.
查看其他版本的 autopy https://pypi.org/project/autopy/ .
谢谢。