蟒蛇外星人游戏,系统飞船图片找不到

import pygame
class Ship:
“”“管理飞船的类”“”
def init(self,ai_game):
“”“初始化飞船并设置其初始位置”“”
self.screen = ai_game.screen
self.screen_rect = ai_game.screen.get_rect()

    #加载飞船图像并获取其外接矩形
    self.image = pygame.image.load('C:\\Users\\86183\\Desktop\\alien_invasion\\aas.png')
    
    self.rect = self.image.get_rect()

    #每艘飞船都放在屏幕底部的中央
    self.rect.midbottom = self.screen_rect.midbottom



def blitme(self):
    """在指定位置绘制飞船"""
    self.screen.blit(self.image,self.rect)

File “c:\Users\86183\Desktop\python_work\alien_invasio.py”, line 22, in init
self.ship = Ship(self)
^^^^^^^^^^
File “c:\Users\86183\Desktop\python_work\alien_invasion\ship.py”, line 10, in init
self.image = pygame.image.load(‘images/ship.bmp’)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you’re using a relative path, make sure to first change your working directory (with os.chdir) to the directory in which the relative path is based.

Uploading: 屏幕截图 2024-07-15 133430.png…
还是不行了,不懂啊

You aren’t embedding your uploaded screenshot properly to the post.

Try copying and pasting your traceback and/or relevant debug info into your post as text, and enclose the text in a pair of ```s for better formatting.

It’s better to use absolute paths than relative paths. You can get the path of the script from __file__.

import pygame
import os

class Ship:
“”“管理飞船的类”“”
def init(self, ai_game):
“”“初始化飞船并设置其初始位置”“”
self.screen = ai_game.screen
self.screen_rect = ai_game.screen.get_rect()

    # 更改工作目录到图片所在的目录
    os.chdir('C:\\Users\\86183\\Desktop\\python_work\\alien_invasion\\ship.bmp')

    # 加载飞船图像并获取其外接矩形,使用相对路径
    self.image = pygame.image.load('ship.bmp')
    self.rect = self.image.get_rect()

    # 每艘飞船都放在屏幕底部的中央
    self.rect.midbottom = self.screen_rect.midbottom

def blitme(self):
    """在指定位置绘制飞船"""
    self.screen.blit(self.image, self.rect)

使用了很多方法还是找不到图片,这问题是出在哪里啊?绝对路径是不是不用保存在同一个地方也可以找到啊?