代码之家  ›  专栏  ›  技术社区  ›  George Udosen

无法在debian(tiangolo/meinheld-gunicorn-flack:python3.8)docker镜像上安装locales包

  •  0
  • George Udosen  · 技术社区  · 3 年前

    我有一个docker图片,我正在尝试添加locales包,以便在我的flask应用程序中使用。debian信息显示此软件包对debian(bulleye)可用,但当我尝试将其安装在docker映像上时,它会出现以下错误:

    #0 0.156 Package locales is not available, but is referred to by another package.
    #0 0.156 This may mean that the package is missing, has been obsoleted, or
    #0 0.156 is only available from another source
    #0 0.156 
    #0 0.156 E: Package 'locales' has no installation candidate
    ------
    failed to solve: executor failed running [/bin/sh -c apt-get install --no-install-recommends locales curl -y]: exit code: 100
    

    我在aws上通过使用fargate部署的ecs服务托管的服务器上的应用程序上显示naira符号时遇到问题。我有这样的代码:

    def naira_symbol_generator(int_curr_symbol: str):
        """
        Function to generate the naira (or any other locale passed to it)
         currency code and symbol
        :param int_curr_symbol: NGN
        :return: Tuple of (int_curr_symbol [NGN], currency_symbol [])
        """
        try:
            import locale
            locale.setlocale(locale.LC_ALL, int_curr_symbol)
            conv = locale.localeconv()
            return conv['int_curr_symbol'], conv['currency_symbol']
        except Exception as e:
            current_app.logger.error(f'naira_symbol_generator function error: {e}')
    

    在服务器上,我看到以下错误:

    2023-05-20 00:29:33 AM WAT] ERROR loggable: helper.py - naira_symbol_generator - 785 - [naira_symbol_generator function error: unsupported locale setting]
    

    以下是我使用该函数的方式:

    naira_symbol_generator("en_NG")[1]
    
    0 回复  |  直到 3 年前