Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 pythonpath 存储在哪里?当我写
import sys sys.path
Python 从哪里获得这些数据?
Python 从模块的路径属性中获取该数据sys。这个路径是 a list,如果你想在路径中添加一个新目录,只需使用该append方法即可。
sys
list
append
例如,要将目录添加/home/me/mypy到路径中,只需执行以下操作:
/home/me/mypy
import sys sys.path.append("/home/me/mypy")