admin管理员组

文章数量:1392095

I'm encountering an issue where the Python kernel crashes with the message "Python Quit Unexpectedly" when attempting to plot a simple DataFrame or call an external Python script from a Jupyter notebook. Here are the details:

Environment:

  • Operating System: macOS 10.14.6
  • Python Version: 3.10.16
  • Package Manager: Using UV's package manager to set up the virtual environment
  • Matplotlib Version: 3.10.1
  • NumPy Version: 2.2.3
  • Pandas Version: 2.2.3

Code that Causes the Crash:

import matplotlib.pyplot as plt
import pandas as pd

simple_df = pd.DataFrame({'A': [1, 2, 3, 4, 5], 'B': [5, 4, 3, 2, 1]})
plt.plot(simple_df)
plt.show()

Additional Information:

  • The crash occurs when executing the plt.show() line.
  • The same issue happens when calling another Python file from a notebook cell with identical code.
  • The MacBook is quite old but should still be supported.

Steps Taken:

  • Verified the versions of Matplotlib, NumPy, and Pandas.
  • Tried running the code in a fresh virtual environment.

Question: Has anyone else encountered this issue, and if so, how was it resolved? Are there any known compatibility issues with these library versions on macOS 10.14.6? Any suggestions or workarounds would be greatly appreciated.

本文标签: