python新手,以前用过Matlab。在
当我尝试在Eric IDE editor for python中运行任何脚本时,收到一条错误消息:“无法启动调试器后端”。(我正在使用各种简单的代码示例来导入和可视化数据。下面是借用代码的示例。)
我安装了python3.6和python3.5(是否应该卸载其中一个?) 我下载了Eric作为编辑器和调试器,并作为管理员安装。在
在Eric Python documentation中,我没有找到解决方案。我确实查看了调试的首选项,并尝试了python3.5和python3.6的路径 我不确定我之前在Eric的“shell”选项卡中修改或破坏了什么。所以我弄坏了东西,无法修复。在
我是否应该尝试卸载Eric以及Python的两个版本(3.5和3.6)并从头开始?在
我想我的问题可能与路径,文件位置等,安装目录有关,真的不确定,并没有找到任何有用的在线搜索后。在
我也不知道什么路径(完整的目录文件名)应该在“运行脚本”窗口的“解释器:”和“工作目录:”中。在
非常感谢任何帮助! 提前谢谢。在
丽贝卡
# Numpy (data import, manipulation, export)
import numpy as np
# Matplotlib (create trends)
import matplotlib.pyplot as plt
# load the data file
data_file = np.genfromtxt('data_file.txt', delimiter=',')
# create time vector from imported data (starts from index 0)
time = data_file[:,0]
# parse good sensor data from imported data
sensors = data_file[:,1:5]
# display the first 6 sensor rows
print(sensors[0:6])
# adjust time to start at zero by subtracting the
# first element in the time vector (index = 0)
time = time - time[0]
# calculate the average of the sensor readings
avg = np.mean(sensors,1) # over the 2nd dimension
# export data
# stack time and avg as column vectors
my_data = np.vstack((time,sensors.T,avg))
# transpose data
my_data = my_data.T
# save text file with comma delimiter
np.savetxt('export_from_python.txt',my_data,delimiter=',')
# generate a figure
plt.figure(1)
plt.plot(time/60.0,sensors[:,1],'ro')
plt.plot(time/60.0,avg,'b.')
# add text labels to the plot
plt.legend(['Sensor 2','Average Sensors 1-4'])
plt.xlabel('Time (min)')
plt.ylabel('Sensor Values')
# save the figure as a PNG file
plt.savefig('my_Python_plot.png')
# show the figure on the screen (pauses execution until closed)
plt.show()
不再收到调试器未启动的错误消息!;)更新此帖子,以防这个答案对其他人有所帮助。我认为问题是由于不知道什么安装在哪里,路径和/或工作目录的位置,以及/或python和Qsintilla版本。不是百分之百肯定。可能的结果是,当我安装各种东西(Python、Eric等)时,不确定哪些项目安装在哪些目录中,可能在安装Python或模块时没有检查“addtopath”。在
相关问题 更多 >
编程相关推荐