简体   繁体   English

ModuleNotFoundError:没有名为“googlemaps”的模块 - 尽管安装了 googlemaps

[英]ModuleNotFoundError: No module named 'googlemaps' - though googlemaps installed

I am running an app.py which imports googlemaps as我正在运行一个 app.py,它将 googlemaps 导入为

import googlemaps

But when I do a pip list, it lists googlemaps as但是当我做一个 pip 列表时,它将googlemaps列为

googlemaps      3.0.2

When I run the app,当我运行应用程序时,

Traceback (most recent call last):


File "app.py", line 40, in <module>
    import googlemaps
ModuleNotFoundError: No module named 'googlemaps'

I am on Windows, Python 3.6.0我在 Windows, Python 3.6.0

In order to be sure.为了确定。 that pip and your script use the same python version I suggest to call following commands from the same terminal window. pip 和您的脚本使用相同的 python 版本我建议从同一终端 window 调用以下命令。

python3 -m pip freeze | grep -i googlemaps
python3 -c "import sys ; print(sys.exewutable)"
python3 -c "import sys ; print("\n".join(sys.path))"

Try even following line to prove that googlemaps is installed if not being called from your app如果没有从您的应用程序调用,甚至尝试以下行来证明已安装googlemaps

python3 -c "import googlemaps"

and

python3 app.py

If you do not call your app directly with python, then tell us how you start the app.如果您不直接使用 python 调用您的应用程序,请告诉我们您是如何启动应用程序的。 This different way of calling might be why it is not pointing to the same python version / virtualenv than the one where you installed googlemaps这种不同的调用方式可能是为什么它指向的 python 版本/ virtualenv 与您安装googlemaps的不同

If you do not know how the app is exactly started (eg started by a web server or similar), then I suggest you add following lines to app.py before the import line that fails.如果您不知道应用程序是如何准确启动的(例如由 web 服务器或类似服务器启动),那么我建议您在失败的导入行之前添加以下行到app.py

import os, sys
# the next two l
with open(os.expanduser("~/debug.txt", "w") as fout:
    fout.write("EXE: %s\n" % sys.executable)
    fout.write("PATH:\n" + ("\n".join(sys.path)))

This should create a file named debug.txt , that you can inspect这应该创建一个名为debug.txt的文件,您可以对其进行检查

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ModuleNotFoundError:没有名为“ googlemaps”的模块 - ModuleNotFoundError: No module named 'googlemaps' “ModuleNotFoundError:即使安装了模块,也没有名为‘...’的模块 - "ModuleNotFoundError: No module named '…' even though module is installed ModuleNotFoundError:即使已安装,也没有名为“pycountry”的模块 - ModuleNotFoundError: No module named 'pycountry' even though it is installed ModuleNotFoundError:尽管在我的Mac OS上安装了panda,但没有名为“ panda”的模块 - ModuleNotFoundError: No module named 'panda' though panda is installed on my mac os ModuleNotFoundError:没有名为“google.cloud”的模块,即使我安装了它 - ModuleNotFoundError: No module named 'google.cloud' even though I installed it ModuleNotFoundError:即使安装了包,也没有名为“matplotlib”的模块 - ModuleNotFoundError: No module named 'matplotlib' even though the package is installed ModuleNotFoundError:即使已安装,也没有名为“制表”的模块 - ModuleNotFoundError: No module named 'tabulate' even though its installed ModuleNotFoundError:即使 Cython 安装在 Azure Devops 中,也没有名为“Cython”的模块 - ModuleNotFoundError: No module named 'Cython' even though Cython is installed in Azure Devops ModuleNotFoundError:即使我安装了功能工具,也没有名为“功能工具”的模块 - ModuleNotFoundError: No module named 'featuretools' even though I have installed featuretools 在python中安装GoogleMaps模块 - installing GoogleMaps module in python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM