我已经在 linux 上使用了 python 模块apriltag
(在此处找到https://pypi.org/project/apriltag/)一段时间,并且需要将我的系统移至 Windows。在我的 Windows 机器上,我尝试在 python3.6 上安装 apriltag pip 包:
python -m pip install apriltag
但是轮子未能构建,给了我一个很长的错误列表,我认为其中的关键是
构建自定义规则 C:/Users/xxxx/apriltag_3b8f424df9f543459d5bd3db09137d9f/core/CMakeLists.txt cl:命令行错误 D8021:无效的数字参数'/Wsign-compare'```
担心 PyPI 包在 windows 上可能不起作用(?)我查看了它所基于的项目,在这里找到https://github.com/swatbotics/apriltag。克隆到它并使用 Visual Studio 构建它,第一个构建失败了
错误 D8021 无效的数字参数“/Wsign-compare”
我在这里查看过,/Wsign-compare
但没有发现任何人甚至得到这个错误的例子,更不用说解决它了。让我知道是否有修复它,或者这个 repo 是否永远不会在 Windows 上构建。
谢谢 :)
编辑:为上下文添加了整个 python 构建日志
python -m pip install apriltag
Collecting apriltag
Using cached apriltag-0.0.16.tar.gz (201 kB)
Building wheels for collected packages: apriltag
Building wheel for apriltag (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\setup.py'"'"'; __file__='"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\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\xxxxxx\AppData\Local\Temp\2\pip-wheel-b7pu6nq2'
cwd: C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\
Complete output (75 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
copying python\apriltag.py -> build\lib.win-amd64-3.6
running build_ext
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.14.26428.1
-- The CXX compiler identification is MSVC 19.14.26428.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found PkgConfig: C:/msys64/usr/bin/pkg-config.exe (found version "0.29.2")
-- Checking for one of the modules 'opencv>=2.3;opencv-2.3.1;opencv-3.0.0'
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
PYTHON_EXECUTABLE
-- Build files have been written to: C:/Users/xxxxxx/AppData/Local/Temp/2/pip-install-4bvz6i3j/apriltag_80d1649893034236a5513184eaa51946/build/temp.win-amd64-3.6/Release
Microsoft (R) Build Engine version 15.7.177.53362 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot
reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\ZERO_CHECK.vcxproj]
Checking Build System
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot
reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\core\apriltag.vcxproj]
Building Custom Rule C:/Users/xxxxxx/AppData/Local/Temp/2/pip-install-4bvz6i3j/apriltag_80d1649893034236a5513184eaa51946/core/CMakeLists.txt
cl : Command line error D8021: invalid numeric argument '/Wsign-compare' [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\core\apriltag.vcxproj]
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 74, in <module>
py_modules=['apriltag']
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
self.run_command('build')
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 35, in run
self.build_extension(ext)
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 60, in build_extension
subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for apriltag
Running setup.py clean for apriltag
Failed to build apriltag
Installing collected packages: apriltag
Running setup.py install for apriltag ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\setup.py'"'"'; __file__='"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\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\xxxxxx\AppData\Local\Temp\2\pip-record-ryn6eco8\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\Include\apriltag'
cwd: C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\
Complete output (77 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
copying python\apriltag.py -> build\lib.win-amd64-3.6
running build_ext
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.14.26428.1
-- The CXX compiler identification is MSVC 19.14.26428.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found PkgConfig: C:/msys64/usr/bin/pkg-config.exe (found version "0.29.2")
-- Checking for one of the modules 'opencv>=2.3;opencv-2.3.1;opencv-3.0.0'
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
PYTHON_EXECUTABLE
-- Build files have been written to: C:/Users/xxxxxx/AppData/Local/Temp/2/pip-install-4bvz6i3j/apriltag_80d1649893034236a5513184eaa51946/build/temp.win-amd64-3.6/Release
Microsoft (R) Build Engine version 15.7.177.53362 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\ZERO_CHECK.vcxproj]
Checking Build System
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\core\apriltag.vcxproj]
Building Custom Rule C:/Users/xxxxxx/AppData/Local/Temp/2/pip-install-4bvz6i3j/apriltag_80d1649893034236a5513184eaa51946/core/CMakeLists.txt
cl : Command line error D8021: invalid numeric argument '/Wsign-compare' [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\core\apriltag.vcxproj]
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 74, in <module>
py_modules=['apriltag']
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 35, in run
self.build_extension(ext)
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 60, in build_extension
subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\setup.py'"'"'; __file__='"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\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\xxxxxx\AppData\Local\Temp\2\pip-record-ryn6eco8\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\Include\apriltag' Check the logs for full command output.```