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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 03:30:11  来源:igfitidea点击:

ImportError: No module named visual

python3dimporterrorvpython

提问by Irfan Ghaffar7

I am trying to run thisPython Program on Ubuntu but I am getting an error that says

我正在尝试在 Ubuntu 上运行这个Python 程序,但我收到一个错误消息

ImportError: No module named visual

Can you guys please guide me on how can I resolve this issue?

你们能指导我如何解决这个问题吗?

回答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

visualmodule has been renamed to vpythonlately.

visual模块已重命名为vpython最近。

So to run this now, you first install vpythonlike:

所以现在要运行它,你首先安装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”。这对我有用。