Clone project 'pearl' from GitHub with top directory 'pearl', but module 'pearl' not found even if marked as source root

I have cloned a project called pearl from GitHub, with top directory pearl. The top directory is supposed to be the top Python module as well.

When trying to execute a test source file with import pearl, PyCharm gives an error “ No module named 'pearl' ”

I have marked pearl as a source root, but that has made no difference; I still get the same error.

What can possibly be wrong?

PS: I've created a simple project showing the same problem:

0
Hi, that's an expected behavior. 

If you run the following snippet

```
import sys
from pprint import pprint
pprint(sys.path)
```

You will probably see that your project root appears there, which means the modules are being searched starting from that root, i.e. omitting the name of the root.

```
from sun import Sun
```
1

请先登录再写评论。