使用PyDev-project在Eclipse 3.8.1中配置工作目录

时间:2015-05-28 11:06:43

标签: python eclipse configuration pydev

我尝试在Eclipse 3.8.1中运行python脚本,但我不断收到错误消息:

IOError: [Errno 2] No such file or directory 

问题出现在代码行中:

train_labels = np.loadtxt("./examples/data/class_train.labels")

以下是我项目的截图:

enter image description here

似乎相对路径从脚本本身的位置开始,而我希望相对路径从项目的根目录开始,即图像中可以看到的RLScore文件夹。

我该如何配置?

P.S。我不想编辑代码,因为这不是我自己的代码,我需要编辑分发中的许多其他文件。

1 个答案:

答案 0 :(得分:1)

尝试:

train_labels = np.loadtxt("../data/class_train.labels")