Как видно из заголовка, несмотря на то, что я успешно установил PyMongo через предложенный способ (выполнение команды python -m pip install pymongo
), получаю ошибку типа ImportError: No module named 'pymongo'
, когда я пытаюсь выполнить скрипт Python, который импорт PyMongo
.
Python
версия: 3.7.0
PyMongo
версия: 3.7.1
(что говорит о лучшем совпадении)
p.s. (1) ОС Windows 10.
(2) Ответы на подобные вопросы не сработали.
Редактировать: Вот вывод команды python -m easy_install pymongo
:
Searching for pymongo
Best match: pymongo 3.7.1
Processing pymongo-3.7.1-py3.7-win-amd64.egg
pymongo 3.7.1 is already the active version in easy-install.pth
Using c:\users\talha\appdata\local\programs\python\python37\lib\site-packages\pymongo-3.7.1-py3.7-win-amd64.egg
Processing dependencies for pymongo
Finished processing dependencies for pymongo
Вывод команды python -m pip install pymongo
:
Requirement already satisfied: pymongo in c:\users\talha\appdata\local\programs\python\python37\lib\site-packages\pymongo-3.7.1-py3.7-win-amd64.egg (3.7.1)
Команда, которую я выполняю для имитации устройства Android через мой скрипт на Python, который использует оба модуля MonkeyRunner
и PyMongo
:
monkeyrunner.bat C:\Users\talha\Documents\PyCharmProjects\MonkeyRunner\test.py
И вот полная трассировка стека ошибок:
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] Script terminated due to an exception
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]Traceback (most recent call last):
File "C:\Users\talha\Documents\PyCharmProjects\MonkeyRunner\test.py", line 3, in <module>
from pymongo import MongoClient
ImportError: No module named pymongo
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.ImportError(Py.java:304)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.imp.import_first(imp.java:755)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.imp.import_module_level(imp.java:837)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.imp.importName(imp.java:917)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.ImportFunction.__call__(__builtin__.java:1220)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyObject.__call__(PyObject.java:357)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.__builtin__.__import__(__builtin__.java:1173)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.imp.importFromAs(imp.java:1011)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.imp.importFrom(imp.java:987)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.pycode._pyx0.f$0(C:\Users\talha\Documents\PyCharmProjects\MonkeyRunner\test.py:39)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.pycode._pyx0.call_function(C:\Users\talha\Documents\PyCharmProjects\MonkeyRunner\test.py)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyTableCode.call(PyTableCode.java:165)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyCode.call(PyCode.java:18)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.runCode(Py.java:1275)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.__builtin__.execfile_flags(__builtin__.java:522)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:225)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:77)
180904 04:34:13.771:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:189)