Python 导入错误:没有名为visual 的模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28592211/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ImportError: No module named visual
提问by Irfan Ghaffar7
回答by no?????z???
The script requires Vpython to be installed.
该脚本需要安装 Vpython。
Then, make sure it is actually installed. Alternatively, move the library into your local folder. If it still doesn't work, check for an __init__
file.
然后,确保它已实际安装。或者,将库移动到您的本地文件夹中。如果它仍然不起作用,请检查__init__
文件。
回答by bhaskarc
visual
module has been renamed to vpython
lately.
visual
模块已重命名为vpython
最近。
So to run this now, you first install vpython
like:
所以现在要运行它,你首先安装vpython
:
sudo pip3 install vpython
then replace the line:
然后替换该行:
from visual import *
with
和
from vpython import *
That worked for me.
那对我有用。
回答by InterestingGuy
You can download a Python27 compatible version of vpython here (direct link).
您可以在此处(直接链接)下载与 Python27 兼容的 vpython 版本。
To use vpython, you should run your code through VIDLE which should've also been installed. Through VIDLE, the syntax "visual" should be accepted. This worked for me.
要使用 vpython,您应该通过也应该安装的 VIDLE 运行您的代码。通过 VIDLE,应该接受语法“visual”。这对我有用。