Код и ошибка:
Проблему можно наблюдать, используя одну строку код:
from google.auth.transport.requests import Request
Следующая ошибка выводится на консоль из google.auth.transport.requests (внизу двух обратных трассировок):
File "", line 3, in raise_from
ImportError: The requests library is not installed, please install the requests package to use the requests transport.
Неудачные попытки
- Удаление и переделка венва.
- Установите модули с параметрами --no-cache-dir и --ignore-installed.
- Выполнение импорта запросы или из google.auth.transport.requests. Запрос на импорт из консоли из env\Scripts\python работает без проблем.
- То же самое строки при помещении в файл temp.py при размещении в следующих каталогах выполняются следующим образом:
- AutoMate\: безопасно
- AutoMate\src\: безопасно
- AutoMate\src\sources\: Ошибка
- AutoMate\src\sources\temp\: безопасно (sources\temp предназначен только для отладки)
- AutoMate\src\sources\util\: безопасно.
- Ни один из модулей аутентификации Google не был установлен в pip за пределами venv.
- Структура проекта следующая:
AutoMate
| temp.py
├───env
│ ├───Include
│ ├───Lib
│ └───Scripts
└───src
│ AutoMate.pyw
│
└───sources
│ calendar.py --> Problematic file
│ whatsapp.py
│ __init__.py
│
└───util - Вывод списка env\Scripts\pip:
------------------------ ---------
cachetools 4.2.1
certifi 2020.12.5
chardet 4.0.0
google-api-core 1.26.1
google-api-python-client 2.0.2
google-auth 1.27.1
google-auth-httplib2 0.1.0
google-auth-oauthlib 0.4.3
googleapis-common-protos 1.53.0
httplib2 0.19.0
idna 2.10
oauthlib 3.1.0
packaging 20.9
pip 21.0.1
protobuf 3.15.5
pyasn1 0.4.8
pyasn1-modules 0.2.8
pyparsing 2.4.7
pytz 2021.1
requests 2.25.1
requests-oauthlib 1.3.0
rsa 4.7.2
selenium 3.141.0
setuptools 49.2.1
six 1.15.0
uritemplate 3.0.1
urllib3 1.26.3
Подробнее здесь: https://stackoverflow.com/questions/665 ... th-library
Мобильная версия