[PYTHON] About import

In python, libraries under a directory belonging to a certain path can be imported.

A path is: The priority is

import sys
print sys.path

Then the path will be returned in the list so you can check which libraries can be imported.

By the way, the module of the project created by django can be automatically imported as a library by the following mechanism.

# -*- coding:utf-8 -*-
import sys, os

# project_directory is the django project directory
#Example) /var/user/django_test_Project path such as project
sys.path.append(os.path.join(project_directory, os.pardir))
import django_test_project

If there is no error in, it is OK.

Recommended Posts

About import
About import
About LangID
About CAGR
About virtiofs
About python-apt
About Permission
About sklearn.preprocessing.Imputer
About gunicorn
About requirements.txt
About locale
About permissions
About Opencv ②
About axis = 0, axis = 1
About Opencv ③
About Python, from and import, as
About numpy
About pip
About Linux
Think about plug-in system-like things-dynamic import-
About numpy.newaxis
About Linux
About import error of PyQt5.QtWidgets (Anaconda)
About Opencv ①
About Linux
About Linux
About Linux ①
About cv2.imread
About _ and __
About wxPython
Notepad about TecoGAN
About python slices
Briefly about __name__
About python comprehension
About Docker Volume
About reference type
About Twitter scraping
2. Make import easier
Learn about programming
About Flask customization
Python module import
About Python tqdm.
About python yield
Notes about with
About python, class
About Linear Models
About Go functions
About pandas describe
Import python script
About Kivy root
scikit-learn import error
About Firestore timeout
About python inheritance
About python, range ()
About Confusion Matrix
[Linux] About PATH
About python decorators
Linux (about groups)
Note about awk
About python reference
About Bitnami Autostart