I have anaconda on EC2 (amazon linux2). It seems that it depends on the environment, but the import order is as follows.
(base) [ec2-user@ip-172-31-42-102 wk]$ echo $PYTHONPATH
/home/ec2-user/wk/lib
(base) [ec2-user@ip-172-31-42-102 wk]$ pwd
/home/ec2-user/wk
(base) [ec2-user@ip-172-31-42-102 wk]$ ls
path.py lib
(base) [ec2-user@ip-172-31-42-102 wk]$ cd ../
(base) [ec2-user@ip-172-31-42-102 ~]$ pwd
/home/ec2-user
(base) [ec2-user@ip-172-31-42-102 ~]$ python3 ./wk/path.py
['/home/ec2-user/wk',
'/home/ec2-user/wk/lib',
'/home/ec2-user',
'/home/ec2-user/anaconda3/lib/python37.zip',
'/home/ec2-user/anaconda3/lib/python3.7',
'/home/ec2-user/anaconda3/lib/python3.7/lib-dynload',
'/home/ec2-user/anaconda3/lib/python3.7/site-packages']
① Directory with py files (2) Directory set in PYTHONPATH ③ Current directory ④ anaconda standard, third party directory
You can check the import order below, so if you're curious, give it a try.
path.py
import sys
import pprint
pprint.pprint(sys.path)
Recommended Posts