Linux VPS上的Discord Bot Python Cog错误

时间:2019-03-16 10:13:27

标签: python linux python-3.x ubuntu discord

所以我已经和一个不和谐的机器人玩了一段时间了,一切都很好,甚至很好。但是,本周我有雄心把这个东西托管在VPS上。创建了一个Ubuntu VM实例,并很快意识到没有正式的python 3.7,但是我找到了一种解决方法,但是当我尝试运行bot时出现此错误,这是我以前从未见过的

Traceback (most recent call last):
  File "bounty.py", line 47, in <module>
    bot.load_extension(str('cogs.' + extension))
  File "/home/luke_oakden02/.local/lib/python3.7/site-packages/discord/ext/commands/bot.py", line 554, in load_extension
    lib.setup(self)
  File "/home/luke_oakden02/BountyBot/cogs/general.py", line 83, in setup
    bot.add_cog(general(bot))
  File "/home/luke_oakden02/.local/lib/python3.7/site-packages/discord/ext/commands/bot.py", line 476, in add_cog
    raise TypeError('cogs must derive from Cog')
TypeError: cogs must derive from Cog
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
  File "bounty.py", line 47, in <module>
    bot.load_extension(str('cogs.' + extension))
  File "/home/luke_oakden02/.local/lib/python3.7/site-packages/discord/ext/commands/bot.py", line 554, in load_extension
    lib.setup(self)
  File "/home/luke_oakden02/BountyBot/cogs/general.py", line 83, in setup
    bot.add_cog(general(bot))
  File "/home/luke_oakden02/.local/lib/python3.7/site-packages/discord/ext/commands/bot.py", line 476, in add_cog
    raise TypeError('cogs must derive from Cog')
TypeError: cogs must derive from Cog

我已经试过了代码,无法解决此问题。我意识到这可能是为了尝试在Ubuntu上运行非官方3.7,但我只是想知道是否有解决方法,或者我是否必须将其升级并降级为3.6并反转一些代码。 ```

我在本节中的代码是

extensions = ["general", "casino", "admin", "owner", "events", "cleverbot", "music", "fun", "wolfram"]
for extension in extensions:
    bot.load_extension(str("cogs." + extension))
bot.run('')

0 个答案:

没有答案