我正在尝试导入.py文件,它给出了错误。正在导入.py文件错误
import thinkplot
和错误:
Traceback (most recent call last): File "", line 1, in import thinkplot ImportError: No module named thinkplotTraceback (most recent call last): File "", line 1, in import thinkplot ImportError: No module named thinkplot
但是当我打开thinkplot.py
文件,然后编写代码import thinkplot
,它工作得很好。但没有打开文件,它不起作用。
在论坛上也有类似的问题,但他们都没有为我工作。我是Python的新手。我该如何解决这个问题?另外,我在ubuntu linux中使用python 2.7。谢谢...
首先尝试编写'import thinkplot'(不含'.py')。 –