[英]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.