Traceback (most recent call last): File "C:/Users/Mr胡/Desktop/飞鸡大战/主模块.py", line 566, in <module> main() File "C:/Users/Mr胡/Desktop/飞鸡大战/主模块.py", line 90, in main add_small_enemies(small_enemies, enemies, 15) File "C:/Users/Mr胡/Desktop/飞鸡大战/主模块.py", line 56, in add_small_enemies e1 = enemy.SmallEnemy(bg_size) File "C:\Users\Mr胡\Desktop\飞鸡大战\enemy.py", line 11, in __init__ pygame.image.load("images/enemy1_down1.png").convert_alpha(), \ FileNotFoundError: No file 'images/enemy1_down1.png' found in working directory 'C:\Users\Mr胡\Desktop\飞鸡大战'.
时间: 2024-04-12 11:33:00 浏览: 112
这个错误是由于找不到文件 'images/enemy1_down1.png' 导致的。在你的代码中,你试图加载图片 'enemy1_down1.png',但是它不存在于当前的工作目录 'C:\Users\Mr胡\Desktop\飞鸡大战' 中。
请确保图片文件 'enemy1_down1.png' 存在于正确的位置并且文件名拼写正确。你可以检查一下图片文件是否在 'C:\Users\Mr胡\Desktop\飞鸡大战\images' 目录下。如果不在该目录下,你需要提供正确的路径来加载图片。
另外,还要确保你的代码中没有其他地方将工作目录更改为其他位置,这可能会导致程序无法找到正确的文件路径。你可以使用 `os.getcwd()` 函数来获取当前工作目录,并确保它与你期望的相符。
如果问题仍然存在,请提供更多的代码和目录结构信息,以便我能够更好地帮助你解决问题。
相关问题
Traceback (most recent call last): File "C:/Users/Mr胡/Desktop/飞鸡大战/主模块.py", line 566, in <module> main() File "C:/Users/Mr胡/Desktop/飞鸡大战/主模块.py", line 90, in main add_small_enemies(small_enemies, enemies, 15) File "C:/Users/Mr胡/Desktop/飞鸡大战/主模块.py", line 56, in add_small_enemies e1 = enemy.SmallEnemy(bg_size) File "C:\Users\Mr胡\Desktop\飞鸡大战\enemy.py", line 8, in __init__ self.image = pygame.image.load("images/enemy1.png").convert_alpha() FileNotFoundError: No file 'images/enemy1.png' found in working directory 'C:\Users\Mr胡\Desktop\飞鸡大战'.
这个错误是由于找不到文件 'images/enemy1.png' 导致的。在你的代码中,你试图加载图片 'enemy1.png',但是它不存在于当前的工作目录 'C:\Users\Mr胡\Desktop\飞鸡大战' 中。
请确保图片文件 'enemy1.png' 存在于正确的位置并且文件名拼写正确。你可以检查一下图片文件是否在 'C:\Users\Mr胡\Desktop\飞鸡大战\images' 目录下。如果不在该目录下,你需要提供正确的路径来加载图片。
另外,还要确保你的代码中没有其他地方将工作目录更改为其他位置,这可能会导致程序无法找到正确的文件路径。你可以使用 `os.getcwd()` 函数来获取当前工作目录,并确保它与你期望的相符。
如果问题仍然存在,请提供更多的代码和目录结构信息,以便我能够更好地帮助你解决问题。
Traceback (most recent call last): File "C:/Users/Mr胡/Desktop/飞鸡大战/主模块.py", line 566, in <module> main() File "C:/Users/Mr胡/Desktop/飞鸡大战/主模块.py", line 84, in main me = myplane.MyPlane(bg_size) File "C:\Users\Mr胡\Desktop\飞鸡大战\myplane.py", line 8, in __init__ self.image1 = pygame.image.load("images/me1.png").convert_alpha() FileNotFoundError: No file 'images/me1.png' found in working directory 'C:\Users\Mr胡\Desktop\飞鸡大战'.
这个错误是由于找不到文件 'images/me1.png' 导致的。在你的代码中,你试图加载图片 'me1.png',但是它不存在于当前的工作目录 'C:\Users\Mr胡\Desktop\飞鸡大战' 中。
请确保图片文件 'me1.png' 存在于正确的位置并且文件名拼写正确。你可以检查一下图片文件是否在 'C:\Users\Mr胡\Desktop\飞鸡大战\images' 目录下。如果不在该目录下,你需要提供正确的路径来加载图片。
另外,还要确保你的代码中没有其他地方将工作目录更改为其他位置,这可能会导致程序无法找到正确的文件路径。你可以使用 `os.getcwd()` 函数来获取当前工作目录,并确保它与你期望的相符。
如果问题仍然存在,请提供更多的代码和目录结构信息,以便我能够更好地帮助你解决问题。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![-](https://img-home.csdnimg.cn/images/20241231044901.png)