我刚刚升级到pycharm 2022.01,并在使用m1 mac调试python程序时出错:
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_cython_wrapper.py", line 8, in <module>
from _pydevd_bundle_ext import pydevd_cython as mod
ModuleNotFoundError: No module named '_pydevd_bundle_ext'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_cython_wrapper.py", line 11, in <module>
from _pydevd_bundle import pydevd_cython as mod
ImportError: cannot import name 'pydevd_cython' from '_pydevd_bundle' (/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 55, in <module>
from _pydevd_bundle.pydevd_trace_dispatch import (
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_trace_dispatch.py", line 42, in <module>
from _pydevd_bundle.pydevd_cython_wrapper import trace_dispatch as _trace_dispatch, global_cache_skips, global_cache_frame_skips, fix_top_level_trace_and_get_trace_func
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_cython_wrapper.py", line 35, in <module>
mod = getattr(__import__(check_name), mod_name)
ImportError: dlopen(/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_cython_darwin_310_64.cpython-310-darwin.so, 0x0002): tried: '/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_cython_darwin_310_64.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
Process finished with exit code 1我安装了正确版本的吡喃。无法在pypi上找到正确的.so版本。我怎么才能解决这个问题?是否可以为arm64e重新编译pydevd?
发布于 2022-04-15 23:51:31
成功地重建了与pydevd一起提供的PyCharm:
重建二进制文件
确保安装了cython以更新和编译cython源代码:
sudo pip3 install cython
export PYTHONPATH=/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev:$PYTHONPATH
cd /Applications/PyCharm.app/Contents/plugins/python/helpers/pydev
python3.10 build_tools/build.py之后,PyCharm中的调试工作进行得很好。
检查二进制文件
重建工作显然是做了什么:
_pydevd_bundle/pydevd_cython.cpython-310-darwin.so
_pydevd_bundle/pydevd_cython_darwin_*.so文件
使用file命令确认二进制文件具有新的M1 (苹果硅)芯片所需的体系结构:
file _pydevd_bundle/pydevd_cython.cpython-310-darwin.so`它应该输出M1所需的体系结构,如下面的arm64:
_pydevd_bundle/pydevd_cython.cpython-310-darwin.so: Mach-O 64-bit bundle arm64发布于 2022-07-03 20:42:06
作为一个快速修复,您可以简单地禁用cython调试。这仍然使您能够运行调试会话,尽管功能较少。
在PyCharm中将其添加到运行配置的环境变量中:
PYDEVD_USE_CYTHON=NOhttps://stackoverflow.com/questions/71889836
复制相似问题