search

Home  >  Q&A  >  body text

python - PyCharm cannot recognize the import path problem

File Directory

spider
    -models
        -test.py
        -customer.py
    

text.py

from customer import Customer

customer = Customer()

PyCharm will prompt Unresolved reference 'customer'

The program runs without problems

I would like to ask, how to make the editor correctly identify the path?

滿天的星座滿天的星座2730 days ago935

reply all(2)I'll reply

  • 某草草

    某草草2017-06-12 09:23:26

    from .customer imort Customer
    或者
    from models.customer import Customer

    reply
    0
  • 阿神

    阿神2017-06-12 09:23:26

    from models.customer import Customer

    reply
    0
  • Cancelreply