请有人帮助这个python初学者[关闭]

jutyujz0  于 2023-05-08  发布在  Python
关注(0)|答案(1)|浏览(154)

**关闭。**这个问题是not reproducible or was caused by typos。目前不接受答复。

此问题是由打印错误或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这一个是解决的方式不太可能帮助未来的读者。
5天前关闭。
Improve this question
当我运行这段代码时,出现了这个错误。???我不知道该怎么办,我不知道会发生什么,我真的需要帮助!
验证码:

import emoji
print (emoji.emojize("Olá mundo! :earth_americas:",use_aliases=True))

错误:

C:\Users\Tiago\PycharmProjects\pythontestes\venv\Scripts\python.exe C:\Users\Tiago\PycharmProjects\pythontestes\Aula08C.py 
Traceback (most recent call last):
  File "C:\Users\Tiago\PycharmProjects\pythontestes\Aula08C.py", line 1, in <module>
    import emoji
  File "C:\Users\Tiago\PycharmProjects\pythontestes\venv\Lib\site-packages\emoji\__init__.py", line 1, in <module>
    from .models import Emoji as emoji_class
  File "C:\Users\Tiago\PycharmProjects\pythontestes\venv\Lib\site-packages\emoji\models.py", line 14, in <module>
    from . import settings
  File "C:\Users\Tiago\PycharmProjects\pythontestes\venv\Lib\site-packages\emoji\settings.py", line 5, in <module>
    EMOJI_IMG_TAG = getattr(settings, 'EMOJI_IMG_TAG', (
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Tiago\PycharmProjects\pythontestes\venv\Lib\site-packages\django\conf\__init__.py", line 102, in __getattr__
    self._setup(name)
  File "C:\Users\Tiago\PycharmProjects\pythontestes\venv\Lib\site-packages\django\conf\__init__.py", line 82, in _setup
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Requested setting EMOJI_IMG_TAG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
3pmvbmvn

3pmvbmvn1#

我认为这个错误的发生是因为use_aliases不是一个有效的关键字参数,尽管它似乎没有抛出这个错误。我觉得你应该试试这样的:

import emoji
print (emoji.emojize("Olá mundo! :earth_americas:", language='alias'))

这是根据文档启用别名的正确方法,您可以找到here。永远记得检查文档,以确保你做的正确,并留下评论,如果你有任何问题。

相关问题