You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Python2.7 Django项目出现Process finished with exit code 134错误求助

解决Python2.7 Django项目抛出SIGABRT(Exit Code 134/Abort Trap:6)的问题

Hey there, sorry to hear you're stuck with this frustrating abort trap issue on your Django 1.6 project running Python 2.7 on Catalina 10.15.6. Based on your description—this started after using Homebrew to install Nginx (and likely pulling in updated system dependencies)—I've got a few targeted fixes and debugging steps to try out:

核心原因分析

Catalina has strict compatibility constraints for older software like Python 2.7, and Homebrew updates often overwrite system libraries (like OpenSSL, MySQL client libraries) that your project's old C-extended packages depend on. When these pre-compiled packages (think MySQL-python, cryptography, libsass) can't hook into the updated system libraries, they trigger a SIGABRT crash.

解决方案步骤

1. 重新编译虚拟环境中的C扩展包

This is the most common fix for post-Homebrew-update crashes. Your existing packages were compiled against older library versions, so we need to rebuild them against the current system libraries:

  • First, activate your virtual environment:
    source /path/to/your/virtualenv/bin/activate
    
  • Uninstall all packages that rely on C extensions (these are usually the culprits):
    pip uninstall -y MySQL-python cryptography libsass Pillow pycrypto pyOpenSSL
    
  • Reinstall them, forcing a fresh compile against your current system libraries:
    pip install MySQL-python==1.2.5 cryptography==2.6.1 libsass==0.18.0 Pillow==5.3.0 pycrypto==2.6.1 pyOpenSSL==19.0.0
    
    Note: If MySQL-python fails to install, specify the path to Homebrew's MySQL client libraries explicitly:
    pip install MySQL-python==1.2.5 --global-option=build_ext --global-option="-I/usr/local/opt/mysql/include" --global-option="-L/usr/local/opt/mysql/lib"
    

2. 降级冲突的Homebrew库

Homebrew might have updated OpenSSL to 1.1+, which has breaking changes for Python 2.7. Roll back to OpenSSL 1.0 to restore compatibility:

  • Install the older OpenSSL version:
    brew install openssl@1.0
    
  • Set environment variables to force your virtual environment to use this version when compiling packages:
    export LDFLAGS="-L/usr/local/opt/openssl@1.0/lib"
    export CPPFLAGS="-I/usr/local/opt/openssl@1.0/include"
    export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.0/lib/pkgconfig"
    
  • Now re-run the reinstall command from step 1 to rebuild packages against OpenSSL 1.0.

3. 替换老旧的MySQL库(备选方案)

MySQL-python 1.2.5 is extremely old and poorly supported on Catalina. Try swapping it for a more modern (but still Python 2.7-compatible) alternative:

pip uninstall -y MySQL-python
pip install mysqlclient==1.3.14

mysqlclient is a maintained fork of MySQL-python and tends to play nicer with newer macOS versions.

4. 临时禁用SIP测试(谨慎操作)

Catalina's System Integrity Protection (SIP) can block older C extensions from accessing system libraries. To test if this is the issue:

  • Restart your Mac and hold Command + R to enter Recovery Mode.
  • Open Terminal from the Utilities menu and run:
    csrutil disable
    
  • Restart your Mac, activate your virtual environment, and test your project. If it works, you know SIP is the blocker—but don't leave SIP disabled long-term. Instead, stick with the recompilation fixes above to make your project SIP-compliant.

额外排查技巧

  • Run commands with verbose output to pinpoint the crashing module:
    python -v manage.py schemamigration
    
    Look for the last module loaded before the crash—this will tell you exactly which package needs fixing.
  • Verify your virtual environment is isolated: Run which python to ensure you're using the virtual environment's Python 2.7, not the system Python.

If these steps don't resolve the issue, you can use a debugger to get a detailed crash backtrace:

lldb -- python manage.py schemamigration

Once it crashes, run bt in lldb to see the full stack trace—this will help narrow down the root cause even further.

内容的提问来源于stack exchange,提问作者Fahad Hussain

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 20:52:33