像 Octave 一样为 Python 添加路径
Addpath for Python like in Octave
我正在学习机器学习入门课程[0], and it teaches Octave. The course introduces a function called addpath() that allows Octave to look in multiple directories for files [1]。
Python中是否存在等效函数?如果没有,有没有办法在 Python 中实现等效功能?
您需要 sys.path
这是一个目录列表,Python 将在其中查找模块。它可以像任何其他列表一样进行操作,例如
import sys
sys.path.append("/my/special/directory")
我正在学习机器学习入门课程[0], and it teaches Octave. The course introduces a function called addpath() that allows Octave to look in multiple directories for files [1]。
Python中是否存在等效函数?如果没有,有没有办法在 Python 中实现等效功能?
您需要 sys.path
这是一个目录列表,Python 将在其中查找模块。它可以像任何其他列表一样进行操作,例如
import sys
sys.path.append("/my/special/directory")