mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Fail CMake setup if trying to build with Python 2 (#35612)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/35612 Python 2 has reached end-of-life and is no longer supported by PyTorch. To spare users from a long, doomed build when trying to use PyTorch with Python 2, detect this case early and fail with a clear message. This commit covers CMake setup. Test Plan: Attempted to build PyTorch with Python 2 and saw a clear error *quickly*. Differential Revision: D20842873 Pulled By: dreiss fbshipit-source-id: b35e38c12f9381ff4ca10cf801b7a03da87b1d19
This commit is contained in:
parent
ac950bb9c8
commit
83de675ebf
|
|
@ -803,9 +803,14 @@ if(BUILD_PYTHON)
|
|||
|
||||
# These should fill in the rest of the variables, like versions, but resepct
|
||||
# the variables we set above
|
||||
set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 2.8 2.7 2.6)
|
||||
find_package(PythonInterp 2.7)
|
||||
find_package(PythonLibs 2.7)
|
||||
set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5)
|
||||
find_package(PythonInterp 3.0)
|
||||
find_package(PythonLibs 3.0)
|
||||
|
||||
if(${PYTHONLIBS_VERSION_STRING} VERSION_LESS 3)
|
||||
message(FATAL_ERROR
|
||||
"Found Python libraries version ${PYTHONLIBS_VERSION_STRING}. Python 2 has reached end-of-life and is no longer supported by PyTorch.")
|
||||
endif()
|
||||
|
||||
# When building pytorch, we pass this in directly from setup.py, and
|
||||
# don't want to overwrite it because we trust python more than cmake
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user