비슷한 문제가있는 사이트를 검색해 보았지만 정확한 딜레마가없는 것 같습니다.Python ImportError : 'convert.py'모듈이 없습니다
파이썬 튜토리얼 서적에서는 섭씨 온도를 화씨로 변환하는 프로그램을 작성했습니다. 유휴 셸에서 실행할 때 프로그램이 작동하지만 오류가 반환됩니다. 다음은 프로그램 자체 코드입니다.
#convert.py
#converts Celsius temperatures to Farenheit
def main():
celsius = input("Type the temperature in degrees Celsius: ")
farenheit = ((9/5)* int(celsius)) + 32
print(farenheit)
main();
오류가 있습니다.
>>> import convert.py
Type the temperature in degrees Celsius: 59
138.2
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import convert.py
ImportError: No module named 'convert.py'; 'convert' is not a package
저는 Python 3.4.1을 사용하고 있습니다.
'.py'가 없으므로';'는 필요하지 않습니다. –