pytorch / tutorials

PyTorch tutorials.
https://pytorch.org/tutorials/
BSD 3-Clause "New" or "Revised" License
8.13k stars 4.04k forks source link

CUSTOM BUILD for iOS #1241

Closed SonicX closed 3 years ago

SonicX commented 3 years ago

I run command: MacbookR7LVDQ:pytorch sonic$ SELECTED_OP_LIST=MobileTernaus.yaml BUILD_PYTORCH_MOBILE=1 IOS_ARCH=arm64 ./scripts/build_ios.sh

but I have error: Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 163, in _run_module_as_main mod_name, _Error) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 119, in _get_module_details code = loader.get_code(mod_name) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 281, in get_code self.code = compile(source, self.filename, 'exec') File "/Users/sonic/pytorch/tools/codegen/gen.py", line 63 def context(msg: str) -> Iterator[None]: ^ SyntaxError: invalid syntax -- CMake Error at cmake/Codegen.cmake:199 (message): Failed to get generated_cpp list Call Stack (most recent call first): caffe2/CMakeLists.txt:2 (include)

-- Configuring incomplete, errors occurred! See also "/Users/sonic/pytorch/build_ios/CMakeFiles/CMakeOutput.log". See also "/Users/sonic/pytorch/build_ios/CMakeFiles/CMakeError.log".

SonicX commented 3 years ago

Я заменил в build_ios.sh версию питона на 3: CMAKE_ARGS+=("-DCMAKE_PREFIX_PATH=$(python3 -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')") CMAKE_ARGS+=("-DPYTHON_EXECUTABLE=$(python3 -c 'import sys; print(sys.executable)')")

И установил переменную: set (CMAKE_IOS_DEVELOPER_ROOT "/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer")