@ftftftftftftff
frontend developer

Почему не видит модуль dotenv?

Начал изучать fast api, хочу вызвать метод load_dotenv, а он не видит модуля
from dotenv import load_dotenv
Пишу pip install dotenv выдает это
pip install dotenv
Collecting dotenv
  Using cached dotenv-0.0.5.tar.gz (2.4 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [85 lines of output]
      C:\Users\hellw\Desktop\fullstack-proj\backend\venv\Lib\site-packages\setuptools\__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.   
      !!
     
              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************
     
      !!
        dist.fetch_build_eggs(dist.setup_requires)
        error: subprocess-exited-with-error
     
        python setup.py egg_info did not run successfully.
        exit code: 1
     
        [17 lines of output]
        Traceback (most recent call last):
          File "<string>", line 2, in <module>
          File "<pip-setuptools-caller>", line 14, in <module>
          File "C:\Users\hellw\AppData\Local\Temp\pip-wheel-fhqlyj7n\distribute_ae7e2e2b623d4505a5b9c378d0283f05\setuptools\__init__.py", line 2, in <module>
            from setuptools.extension import Extension, Library
          File "C:\Users\hellw\AppData\Local\Temp\pip-wheel-fhqlyj7n\distribute_ae7e2e2b623d4505a5b9c378d0283f05\setuptools\extension.py", line 5, in <module>
            from setuptools.dist import _get_unpatched
          File "C:\Users\hellw\AppData\Local\Temp\pip-wheel-fhqlyj7n\distribute_ae7e2e2b623d4505a5b9c378d0283f05\setuptools\dist.py", line 7, in <module>
            from setuptools.command.install import install
          File "C:\Users\hellw\AppData\Local\Temp\pip-wheel-fhqlyj7n\distribute_ae7e2e2b623d4505a5b9c378d0283f05\setuptools\command\__init__.py", line 8, in <module>
            from setuptools.command import install_scripts
          File "C:\Users\hellw\AppData\Local\Temp\pip-wheel-fhqlyj7n\distribute_ae7e2e2b623d4505a5b9c378d0283f05\setuptools\command\install_scripts.py", line 3, in <module>
            from pkg_resources import Distribution, PathMetadata, ensure_directory
          File "C:\Users\hellw\AppData\Local\Temp\pip-wheel-fhqlyj7n\distribute_ae7e2e2b623d4505a5b9c378d0283f05\pkg_resources.py", line 1518, in <module>
            register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
        [end of output]
     
        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: metadata-generation-failed
     
      Encountered error while generating package metadata.
     
      See above for output.
     
      note: This is an issue with the package mentioned above, not pip.
      hint: See above for details.
      Traceback (most recent call last):
        File "C:\Users\hellw\Desktop\fullstack-proj\backend\venv\Lib\site-packages\setuptools\installer.py", line 96, in _fetch_build_egg_no_warn
          subprocess.check_call(cmd)
        File "C:\Users\hellw\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['C:\\Users\\hellw\\Desktop\\fullstack-proj\\backend\\venv\\Scripts\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--
no-deps', '-w', 'C:\\Users\\hellw\\AppData\\Local\\Temp\\tmp6xojdyif', '--quiet', 'distribute']' returned non-zero exit status 1.
     
      The above exception was the direct cause of the following exception:
     
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\hellw\AppData\Local\Temp\pip-install-kjqsobl2\dotenv_b9879334548e4520a4f99e0c5cd90ea0\setup.py", line 13, in <module>
          setup(name='dotenv',
        File "C:\Users\hellw\Desktop\fullstack-proj\backend\venv\Lib\site-packages\setuptools\__init__.py", line 106, in setup
          _install_setup_requires(attrs)
        File "C:\Users\hellw\Desktop\fullstack-proj\backend\venv\Lib\site-packages\setuptools\__init__.py", line 79, in _install_setup_requires
          _fetch_build_eggs(dist)
        File "C:\Users\hellw\Desktop\fullstack-proj\backend\venv\Lib\site-packages\setuptools\__init__.py", line 84, in _fetch_build_eggs
          dist.fetch_build_eggs(dist.setup_requires)
        File "C:\Users\hellw\Desktop\fullstack-proj\backend\venv\Lib\site-packages\setuptools\dist.py", line 917, in fetch_build_eggs
          return _fetch_build_eggs(self, requires)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.

связано ли это с тем что у меня версия python 3.11.2 ??
как это исправить?
  • Вопрос задан
  • 705 просмотров
Пригласить эксперта
Ответы на вопрос 1
SoreMix
@SoreMix
yellow
pip install python-dotenv
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы