You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

学习Python游戏开发课程遇ModuleNotFoundError: No module named 'sos'求助

课程代码报错:ModuleNotFoundError: No module named 'sos'

我正在学习*《Python Game Development™ : Build 11 Total Games》*课程,目前学到第26个视频,运行代码时出现报错:

Traceback (most recent call last):
  File "C:\Users\User\Desktop\python games\base.py", line 5, in <module>
    import sos
ModuleNotFoundError: No module named 'sos'

我感到困惑,因为课程中的讲师没有遇到这个错误。目前经过他人协助,仅剩余import sos这一处错误未解决,我已回顾课程内容但未发现遗漏,附上我的代码片段如下:

import collection

import math

import sos

def path(filename):
    filepath = os.path.realpath(__file__)
    dirpath = os.path.dirname
    fullpath = os.path.join(dirpath,filename)
    return fullpath

def line(a,b,x,y):
    import turtle
    turtle.up()
    turtle.goto(a,b)
    turtle.down()
    turtle.goto(x,y)

class vector(collection.Sequence):
    PRECISION = 6
    __slots__ = ('_x','_y','_hash')

    def __init__(self,x,y):
        self._hash = None
        self._x = round(x,self.PRECISION)

    @property
    #getter
    def x(self):
        return self._x

    @x.setter
    def x(self,value):
        if self._hash is not None:
            raise ValueError('Cannot set x after hashing')
        self._x = round(value,self.PRECISION)

    @property
    def y(self):
        return self._y
    @y.setter
    def y(self,value):
        if self._hash is not None:
            raise ValueError('Cannot set x after hashing')
        self._x = round(value,self.PRECISION)

恳请帮忙解决该问题,非常感谢!

内容的提问来源于stack exchange,提问作者user21130922

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 09:05:14