How to add a Python module search path

How to do it inside the program

import sys,os
sys.path.append('Directory where the module is installed')

(Example)
sys.path.append('/tmp/hoge/lib/python2.7/site-packages')

Command line

export PYTHONPATH=Directory where the module is installed

(Example)
export PYTHONPATH='/tmp/hoge/lib/python2.7/site-packages'

Recommended Posts

How to add a Python module search path
How to add python module to anaconda environment
To add a module to python put in Julialang
To add a C module to MicroPython ...
A story about how to specify a relative path in python.
[Python] How to display random numbers (random module)
python3 How to install an external module
[Python] How to convert a 2D list to a 1D list
How to get a stacktrace in python
[Python] How to deal with module errors
Add a Python virtual environment to VSCode
How to run a Maya Python script
[Python] How to add rows and columns to a table (pandas DataFrame)
How to read a CSV file with Python 2/3
How to create a Python virtual environment (venv)
How to open a web browser from python
How to clear tuples in a list (Python)
How to install Python
How to embed a variable in a python string
Create a Python module
How to create a JSON file in Python
How to install python
How to generate a Python object from JSON
[Python] How to read a csv file (read_csv method of pandas module)
How to notify a Discord channel in Python
[Python] How to draw a histogram in Matplotlib
How to uninstall a module installed using setup.py
[Discord.py] How to add or remove job titles after a reaction [python]
How to convert / restore a string with [] in python
[Python] [Django] How to use ChoiceField and how to add options
How to add help to HDA (with Python script bonus)
Try to make a Python module in C language
[Python] How to draw a line graph with Matplotlib
How to set up a Python environment using pyenv
How to use the Raspberry Pi relay module Python
[Python] How to expand variables in a character string
How to write a list / dictionary type of Python3
I made a Python module to translate comment outs
How to build a Django (python) environment on docker
How to make a Python package using VS Code
[Python] How to write a docstring that conforms to PEP8
How to add page numbers to PDF files (in Python)
How to save a table scraped by python to csv
[Morphological analysis] How to add a new dictionary to Mecab
[Python] How to create a 2D histogram with Matplotlib
How to execute a command using subprocess in Python
How to build a Python environment on amazon linux 2
[Python] How to call a c function from python (ctypes)
How to create a kubernetes pod from python code
[Python] How to draw a scatter plot with Matplotlib
[2020.8 latest] How to install Python
How to install Python [Windows]
How Python module import works
How to use search sorted
A road to intermediate Python
[Python] How to use list 1
Add a dictionary to MeCab
How to call a function
How to use Python argparse
How to hack a terminal
Python: How to use pydub