Python import directory order (on anaconda)

Python import order

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

Python import directory order (on anaconda)
Install Python 3.7 Anaconda on MAC, but Python 2
Installing Anaconda Python on an ECS instance
Build Python environment with Anaconda on Mac
Python 3.3 in Anaconda
Python module import
Python on Windows
twitter on python3
Import python script
Theano on Anaconda
python on mac
pyenv + anaconda + python3
Python on Windbg
Summarize Python import
Build Python3.5 + matplotlib environment on Ubuntu 12 using Anaconda
Install OpenCV 4.0 and Python 3.7 on Windows 10 with Anaconda
[Node-RED] Execute Python on Anaconda virtual environment from Node-RED [Anaconda] [Python]
[Python] How to install OpenCV on Anaconda [Windows]
Python conda on cygwin
Install python on WSL
[Python] File / directory operations
PyOpenGL setup on Python 3
Install Python on Pidora.
Install Scrapy on python3
[Note] Anaconda & VScode has trouble with python import error
[Reintroduction to python] How to import via the parent directory
Python from or import
Specify upper directory / subdirectory with relative import of Python
Install Python on Mac
Install Python 3 on Mac
Create a comfortable Python 3 (Anaconda) development environment on windows
Install Python3.4 on CentOS 6.6
Installing pandas on python2.6
Use Python 3.8 with Anaconda
Anaconda on Windows Terminal
Install Anaconda on Windows 10
python basic on windows ②
Install python on windows
Install Python 2.7.3 on CentOS 5.4
build Python on Ubuntu
Install Python 3.3 on Ubuntu 12.04
Import tsv with Python
Install Python 3.4 on Mac
Install django on python + anaconda and start the server
Install Python 3.6 on Docker
Natural order in python
[Note] Import of a file in the parent directory in Python
Set-enable Python virtualenv on Windows
Python + Anaconda + Pycharm environment construction
Install cvxopt on 64bit Anaconda
Set up Python 3.4 on Ubuntu
Run Openpose on Python (Windows)
Install Python 3.8 on RHEL 8 (AppStream)
Python 2 series and 3 series (Anaconda edition)
Use matplotlib on Ubuntu 12 & Python
Install watchdog on Windows + Python 3.3
Python on Ruby and angry Ruby on Python
Dynamically import scripts in Python
Anaconda environment construction on CentOS7
Import vtk with brew python
Install pygame on python3.4 on mac