【发布时间】:2019-09-17 17:43:23
【问题描述】:
我正在尝试在我的计算机上安装 PyOpenGL:
- Windows 10、64 位
- Python 3.7
显然,我需要同时安装 PyOpenGL 和 PyOpenGL_accelerate 软件包。
1。安装 PyOpenGL
pip install PyOpenGL 命令可以正常工作:
C:\Users\Kristof>pip install PyOpenGL
Collecting PyOpenGL
Installing collected packages: PyOpenGL
Successfully installed PyOpenGL-3.1.0
2。安装 PyOpenGL_accelerate (FIRST ATTEMPT)
pip install PyOpenGL_accelerate 命令失败:
C:\Python37\PyOpenGL-accelerate-3.1.0>pip install PyOpenGL_accelerate --no-cache-dir
Collecting PyOpenGL_accelerate
Downloading https://files.pythonhosted.org/packages/d9/74/293aa8794f2f236186d19e61c5548160bfe159c996ba01ed9144c89ee8ee/PyOpenGL-accelerate-3.1.0.tar.gz (323kB)
|████████████████████████████████| 327kB 1.3MB/s
Building wheels for collected packages: PyOpenGL-accelerate
Building wheel for PyOpenGL-accelerate (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Kristof\\AppData\\Local\\Temp\\pip-install-w04pgijy\\PyOpenGL-accelerate\\setup.py'"'"'; __file__='"'"'C:\\Users\\Kristof\\AppData\\Local\\Temp\\pip-install-w04pgijy\\PyOpenGL-accelerate\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Kristof\AppData\Local\Temp\pip-wheel-x4gprfbc' --python-tag cp37
cwd: C:\Users\Kristof\AppData\Local\Temp\pip-install-w04pgijy\PyOpenGL-accelerate\
Complete output (48 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\OpenGL_accelerate
copying .\__init__.py -> build\lib.win-amd64-3.7\OpenGL_accelerate
running build_ext
skipping 'src\wrapper.c' Cython extension (up-to-date)
building 'OpenGL_accelerate.wrapper' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Kristof\AppData\Local\Temp\pip-install-w04pgijy\PyOpenGL-accelerate\.. -IC:\Users\Kristof\AppData\Local\Temp\pip-install-w04pgijy\PyOpenGL-accelerate\src -IC:\Users\Kristof\AppData\Local\Temp\pip-install-w04pgijy\PyOpenGL-accelerate -Ic:\python37\include -Ic:\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc\wrapper.c /Fobuild\temp.win-amd64-3.7\Release\src\wrapper.obj
wrapper.c
src\wrapper.c(3919): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\wrapper.c(4376): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\wrapper.c(11474): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11475): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11476): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11488): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11489): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11490): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11491): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11492): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11493): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11536): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11537): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11538): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11539): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11540): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11541): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for PyOpenGL-accelerate
Running setup.py clean for PyOpenGL-accelerate
Failed to build PyOpenGL-accelerate
Installing collected packages: PyOpenGL-accelerate
Running setup.py install for PyOpenGL-accelerate ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Kristof\\AppData\\Local\\Temp\\pip-install-w04pgijy\\PyOpenGL-accelerate\\setup.py'"'"'; __file__='"'"'C:\\Users\\Kristof\\AppData\\Local\\Temp\\pip-install-w04pgijy\\PyOpenGL-accelerate\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Kristof\AppData\Local\Temp\pip-record-1ulnpq1p\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\Kristof\AppData\Local\Temp\pip-install-w04pgijy\PyOpenGL-accelerate\
Complete output (48 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\OpenGL_accelerate
copying .\__init__.py -> build\lib.win-amd64-3.7\OpenGL_accelerate
running build_ext
skipping 'src\wrapper.c' Cython extension (up-to-date)
building 'OpenGL_accelerate.wrapper' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Kristof\AppData\Local\Temp\pip-install-w04pgijy\PyOpenGL-accelerate\.. -IC:\Users\Kristof\AppData\Local\Temp\pip-install-w04pgijy\PyOpenGL-accelerate\src -IC:\Users\Kristof\AppData\Local\Temp\pip-install-w04pgijy\PyOpenGL-accelerate -Ic:\python37\include -Ic:\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc\wrapper.c /Fobuild\temp.win-amd64-3.7\Release\src\wrapper.obj
wrapper.c
src\wrapper.c(3919): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\wrapper.c(4376): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\wrapper.c(11474): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11475): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11476): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11488): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11489): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11490): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11491): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11492): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11493): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11536): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11537): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11538): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11539): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11540): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11541): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Kristof\\AppData\\Local\\Temp\\pip-install-w04pgijy\\PyOpenGL-accelerate\\setup.py'"'"'; __file__='"'"'C:\\Users\\Kristof\\AppData\\Local\\Temp\\pip-install-w04pgijy\\PyOpenGL-accelerate\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Kristof\AppData\Local\Temp\pip-record-1ulnpq1p\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
3。安装 PyOpenGL_accelerate (第二次尝试)
我为 Windows 64 位下载了一个预构建的包:
https://pypi.org/project/PyOpenGL-accelerate/#files
没有适用于 Python 3.7 的文件,所以我采用最新的一个,适用于 Python 3.4:PyOpenGL-accelerate-3.1.0.win-amd64-py3.4.exe
不幸的是,安装过程停止并显示错误消息:找不到 Python 3.4 安装。
4。安装 PyOpenGL_accelerate (第三次尝试)
我回到同一个下载页面:
https://pypi.org/project/PyOpenGL-accelerate/#files
我下载源代码:PyOpenGL-accelerate-3.1.0.zip (340.0 kB)
接下来我打开一个 Windows 终端,导航到解压后的文件夹并运行 setup.py(注意:我的 Python 3.7 安装位于 C:\Python37\,我将文件夹解压到 C:\Python37\PyOpenGL-accelerate-3.1.0):
C:\Users\Kristof>cd C:\Python37\PyOpenGL-accelerate-3.1.0
C:\Python37\PyOpenGL-accelerate-3.1.0>python setup.py install
running install
running bdist_egg
running egg_info
writing PyOpenGL_accelerate.egg-info\PKG-INFO
writing dependency_links to PyOpenGL_accelerate.egg-info\dependency_links.txt
writing top-level names to PyOpenGL_accelerate.egg-info\top_level.txt
reading manifest file 'PyOpenGL_accelerate.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'PyOpenGL_accelerate.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\OpenGL_accelerate
copying .\__init__.py -> build\lib.win-amd64-3.7\OpenGL_accelerate
running build_ext
skipping 'src\wrapper.c' Cython extension (up-to-date)
building 'OpenGL_accelerate.wrapper' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Python37\PyOpenGL-accelerate-3.1.0\.. -IC:\Python37\PyOpenGL-accelerate-3.1.0\src -IC:\Python37\PyOpenGL-accelerate-3.1.0 -IC:\Python37\include -IC:\Python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc\wrapper.c /Fobuild\temp.win-amd64-3.7\Release\src\wrapper.obj
wrapper.c
src\wrapper.c(3919): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\wrapper.c(4376): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\wrapper.c(11474): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11475): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11476): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11488): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11489): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11490): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11491): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11492): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11493): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11536): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11537): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11538): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11539): error C2039: 'exc_type': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11540): error C2039: 'exc_value': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
src\wrapper.c(11541): error C2039: 'exc_traceback': is not a member of '_ts'
c:\python37\include\pystate.h(209): note: see declaration of '_ts'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
5。我的问题
我现在真的被困住了。请帮忙:
PyOpenGL被放弃了吗?
最新的预构建可执行文件可以追溯到 Python 3.4 时代。那是5年前的事了。为什么这么多年没有更新?如何安装
PyOpenGL_accelerate?
我尝试了三种不同的方式来安装这个东西。你能帮忙吗?
【问题讨论】:
标签: python python-3.x windows opengl pyopengl