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

PyCharm执行代码持续运行无结果,寻求配置调整方案

Fixes for PyCharm Stuck on "Executing Code in Console" When Reading Excel Files

Hey there! I’ve dealt with similar IDE quirks switching from Spyder to PyCharm, so let’s work through some fixes to get your Excel-reading code running smoothly:

  • Double-check your Python interpreter
    PyCharm often defaults to a different environment than Spyder (like a fresh virtual env vs. your Anaconda setup). Head to File > Settings > Project: [Your Project] > Python Interpreter and confirm you’re using the same interpreter you rely on in Spyder. If not, use the dropdown to switch to your preferred environment.

  • Verify your file path is correct
    PyCharm’s working directory might not match Spyder’s! If you’re using a relative path (e.g., pd.read_excel("titanic.xlsx")), PyCharm could be looking in the wrong folder. First, print your current working directory to check:

    import os
    print(os.getcwd())
    

    Either move your Excel file to this directory, or switch to an absolute path (like pd.read_excel("/Users/YourName/Documents/titanic.xlsx")) to avoid confusion.

  • Turn off "Run with Python Console"
    The "Executing Code in Console" message suggests your run configuration is set to launch the script in the interactive console. Right-click your script, select Modify Run Configuration, then uncheck the Run with Python Console box. Running in regular mode will send output directly to the Run tab, which is less likely to get stuck.

  • Kill stuck background processes
    Sometimes PyCharm’s console processes hang silently. Check the bottom Run or Terminal panels, stop any active processes, then restart your script.

  • Update PyCharm and libraries
    Outdated software can cause weird hangs. Update PyCharm to the latest version via Help > Check for Updates. Also, make sure pandas and the Excel-reading backend are up to date:

    pip install --upgrade pandas openpyxl
    

Give these steps a try—chances are one of them will resolve the issue!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.13 07:43:05