问题描述
IOError:我在Eclipse 3.8.1中运行一个python脚本, [Errno 2]没有这样的文件或目录
问题出现在代码行:
train_labels = np.loadtxt(./ examples / data / class_train.labels)
/ pre>
这是我的项目的屏幕截图:
看起来相对路径从脚本本身的位置开始,我想要相对路径从项目的根目录开始,即RLScore-文件夹,如图所示。
如何配置?
我不想编辑代码,因为这不是我自己的代码,我需要做的编辑到许多其他文件的分布。
解决方案尝试:
train_labels = np.loadtxt(../ data / class_train.labels)
I'm trying run a python script in Eclipse 3.8.1 but I keep getting the error message:
IOError: [Errno 2] No such file or directory
The problem occurs in a code line:
train_labels = np.loadtxt("./examples/data/class_train.labels")
Here is a screenshot of my project:
It seems the relative path starts from the location of the script itself, whereas I would want the relative path start from the root directory of the project, that is the RLScore-folder as you can see in the image.
How do I configure this?
P.S. I wouldn't want to edit the code, because this is not my own code and I would need to do the editing into many other files in the distribution.
解决方案try :
train_labels = np.loadtxt("../data/class_train.labels")
这篇关于在Eclipse 3.8.1中使用PyDev-project配置工作目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!