Python 無法在同一文件夾中找到模塊

| | |

我的 python 在同一目錄中找不到任何模塊。我做錯了什麼?(python2.7)

所以我有一個目錄“2014_07_13_test”,其中有兩個文件:

  1. test.py
  2. hello.py

where hello.py:

# !/usr/local/bin/python # -*- coding: utf-8 -*- def hello1(): print "HelloWorld!" 

and test.py:

# !/usr/local/bin/python # -*- coding: utf-8 -*- from hello import hello1 hello1() 

仍然python給出我

>>> Traceback(最近一次調用最後):文件“<stdin>”,第 1 行,在 <module> 文件“<string>”,行4、在<module> ImportError: No module named hello 

什麼問題?

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News


Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method