我正在嘗試導入.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')。 –