Python> sys.path> List of strings indicating the path to search for modules

@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic (No. 3078 / 12833)

Where does Python look for files to import? It uses a list of directory names and ZIP archive files stored in the standard sys module as the variable path.

I've tried.

http://ideone.com/ymwEWM

import sys
for place in sys.path:
	print(place)

run


/home/aE6sH9
/usr/lib/python35.zip
/usr/lib/python3.5
/usr/lib/python3.5/plat-x86_64-linux-gnu
/usr/lib/python3.5/lib-dynload
/usr/local/lib/python3.5/dist-packages
/usr/lib/python3/dist-packages

Reference: sys.path

A list of strings that indicate the path to search for the module. It is initialized with the PYTHONPATH environment variable and the default path specified during installation.

Recommended Posts

Python> sys.path> List of strings indicating the path to search for modules
List of python modules
Python script to get a list of input examples for the AtCoder contest
Easy way to check the source of Python modules
Try to get the function list of Python> os package
[Python] How to make a list of character strings character by character
Google search for the last line of the file in Python
About the basics list of Python basics
How to change the log level of Azure SDK for Python
python note: map -do the same for each element of the list
[Python] A program that rotates the contents of the list to the left
Change the length of Python csv strings
Implement the shortest path search for the maze
Pass the path of the imported python module
Check the path of the Python imported module
Pandas of the beginner, by the beginner, for the beginner [Python]
Python amateurs try to summarize the list ①
In search of the fastest FizzBuzz in Python
Summary of how to use Python list
[Introduction to Python] How to sort the contents of a list efficiently with list sort
Search for synonyms from the word list (csv) using Python Japanese WordNet
I measured the speed of list comprehension, for and while with python2.7.
[Python] Master the reading of csv files. List of main options for pandas.read_csv.
How to pass the execution result of a shell command in a list in Python
The fastest way for beginners to master Python
[python] Check the elements of the list all, any
The story of low learning costs for Python
[Python] Sort the list of pathlib.Path in natural sort
[Introduction to Udemy Python 3 + Application] 19. Copy of list
To speed up python, summarize the amount of calculation of collection type (list / tuple / dictionary / set) for each purpose.
Make a copy of the list in Python
How to add a Python module search path
Image processing? The story of starting Python for
[Python] Scan the inside of the folder including subfolders → Export the file list to CSV
[Algorithm x Python] How to use the list
Code for checking the operation of Python Matplotlib
Search by the value of the instance in the list
To get the path of the currently running python.exe
List of Python code to move and remember
[Introduction to Algorithm] Find the shortest path [Python3]
A python amateur tries to summarize the list ②
Remove specific strings at the end of python
How to get a list of files in the same directory with python
Convert strings to character-by-character list format with python
[Introduction to Python] How to get the index of data with a for statement
After hitting the Qiita API with Python to get a list of articles for beginners, we will visit the god articles
The first step of machine learning ~ For those who want to implement with python ~
How to identify the element with the smallest number of characters in a Python list?
How to check in Python if one of the elements of a list is in another list
Output the specified table of Oracle database in Python to Excel for each file
How to count the number of occurrences of each element in the list in Python with weight
python beginners tried to predict the number of criminals
[Python] How to remove duplicate values from the list
Template of python script to read the contents of the file
How to get the number of digits in Python
List of posts related to optimization by Python to docker
List of Python libraries for data scientists and data engineers
List of sample program distribution sites for python books
[python] option to turn off the output of click.progressbar
How to write a list / dictionary type of Python3
[Boto3] Search for Cognito users with the List Users API