'Google Cloud TTS API for M1 Mac
If I run Google TTS API Python sample code in M1 mac, below error message shown. Can I use Google Cloud TTS API in M1 mac or not?
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/grpc/_cython/cygrpc.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/cygrpc.cpython-310-darwin.so' (no such file)
Solution 1:[1]
If you're using PyCharm, this can be solved by following the steps here. In case that link breaks, here are the instructions:
Assuming a project
test_pkg_install_m1
withvenv
virtual environment insideCreate
pythonM1
file insidetest_pkg_install_m1/venv/bin
with the following content:
#!/usr/bin/env zsh
mydir=${0:a:h}
/usr/bin/arch -x86_64 $mydir/python "$@"
- Make the file executable with
chmod +x pythonM1
- Add new interpreter in Preferences -> Project ... -> Project Interpreter targeting
pythonM1
as executable
Now all Python processes running by PyCharm will be executed with arch -x86_64
including package installation.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | John R Perry |