简体   繁体   English

如何修复“FileNotFoundError:没有这样的文件或目录。” 当使用 Python 时?

[英]How to fix the "FileNotFoundError: No such file or directory." when using Python?

So I am trying to use this Python code for a spectrograph.所以我正在尝试将这个 Python 代码用于光谱仪。 I haven't done much Python and have no clue how to fix this issue.我没有做太多 Python 并且不知道如何解决这个问题。 As you can see in the image it says that it cant find the file, from what i understand, where its searching for it.正如您在图片中看到的那样,它说它无法找到文件,据我所知,它在哪里搜索它。 Screenshot of the code代码截图

I first tried fixing the problem by finding out how to move the file to where its looking for it using Shutil but i ran into the problem "SyntaxError: Unicode error" which i did not expect, probably because of my limited knowledge of python. Screenshot of error我首先尝试通过找出如何使用 Shutil 将文件移动到它寻找它的位置来解决问题,但我遇到了我没想到的问题“SyntaxError:Unicode 错误”,可能是因为我对 python 的了解有限。屏幕截图错误的

Try this试试这个

You have to convert the simple string to raw string.您必须将简单字符串转换为原始字符串。

shutil.move("Spectrograph_data.csv", r"C:Users\...")

Or replace '\' with "\\" .或者将'\'替换为"\\"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python 3:如何修复FileNotFoundError:[Errno 2]没有这样的文件或目录 - Python 3: How to fix FileNotFoundError: [Errno 2] No such file or directory FileNotFoundError: [Errno 2] 没有这样的文件或目录。 Python 无法正确读取文件 - FileNotFoundError: [Errno 2] No such file or directory. Python not reading files correctly 在python中用熊猫读取Excel文件如何修复:FileNotFoundError(2,'No such file or directory') - Reading excel file with pandas in python how to fix : FileNotFoundError(2, 'No such file or directory') FileNotFoundError:[错误2]没有此类文件或目录。 的Ubuntu - FileNotFoundError: [Errno 2] No such file or directory. Ubuntu FileNotFoundError:没有这样的文件或目录。 即使它存在 - FileNotFoundError: No such file or directory. Even though it exists Mac 操作系统; 蟒蛇3; FileNotFoundError: [Errno 2] 没有这样的文件或目录:''。 如何解决? - Mac OS; Python3; FileNotFoundError: [Errno 2] No such file or directory: ''. How to fix it? 如何解决:FileNotFoundError:[Errno 2]没有这样的文件或目录 - How to fix: FileNotFoundError: [Errno 2] No such file or directory 如何修复FileNotFoundError Errno 2没有这样的文件或目录 - how to fix FileNotFoundError Errno 2 no such file or directory 如何修复 FileNotFoundError: [Errno 2] No such file or directory: no - How to fix FileNotFoundError: [Errno 2] No such file or directory: no FileNotFoundError: [Errno 2] 没有这样的文件或目录; 怎么修? - FileNotFoundError: [Errno 2] No such file or directory; How to fix?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM