gpt4 book ai didi

python - Vscode,python 段错误(核心转储)

转载 作者:行者123 更新时间:2023-12-04 10:53:15 25 4
gpt4 key购买 nike

我对 vscode 和 python 有疑问。我创建了与 python3 解释器一起使用的简单 python 脚本,然后使用 python3 test.py 运行它,这很好。

import numpy as np 
import matplotlib.pyplot as plt

Ts = 0.01
t = np.arange(-5, 5, Ts)

y = t**2
plt.plot(y)
plt.show()

但是当我尝试使用 vscode 调试运行它时,我得到一个段错误(核心转储)。
agentdenton@agentdenton-latitude:~/dev/Test/numpy_test$ python3 test.py 
Segmentation fault (core dumped)

这很奇怪,因为相同的代码在具有相同 Ubuntu 的我的 VM 上运行良好。我想知道我在这里做错了什么还是错误?
我正在使用 ubuntu 19.04 和最新版本的 vscode 也是 python 3.7.5。只有当我导入一些模块并从中执行函数时才会发生错误,使用常规的 python 代码可以正常工作。
感谢您的关注,对糟糕的英语能力深表歉意!

最佳答案

VS代码可能污染了python环境。您可以卸载 python 环境并重新安装新的干净环境。如果使用 conda,可以通过 conda update --all 更新环境.

关于python - Vscode,python 段错误(核心转储),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59363272/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com