是sys.path中路径的python搜索模块吗? 如何手动更改它?
解决方案Ju Hui写道:是sys.path中路径的python搜索模块吗? sys.path是Python解释器搜索的路径列表 模块,是的。 如何更改它manuallly?
手动 ? - ) 你的意思是动态地,通过代码 ?如果是的话,它只是一个列表。您可以像对待任何其他列表一样修改它。 否则,您可能需要查看PYTHON_PATH环境变量。 /> - bruno desthuilliers python -c" print''@''。join([''。''' .join([w [:: - 1] for p in p.split(''。'')])for p in''o****@xiludom.gro''。 split(''@'')])"
是的,我的意思是我要更改sys.path值并将其保存到下一个 使用。 我可以更改sys.path的值,但我不能保存它是永久性的。 我的电脑上没有python_path环境,它与sys.path之间的关系是什么? Ju Hui写道:是的,我的意思是我要更改sys.path值并将其保存到下一个使用。我可以更改sys.path的值,但我不能保存永久。我的电脑上没有python_path环境,它和sys.path之间的关系是什么?
在Windows中,至少,您可以创建PYTHONPATH变量并为其分配 ,这是您希望Python在运行脚本时检查的目录的路径。
is python search module by paths in sys.path? how to change it manuallly?
解决方案 Ju Hui wrote: is python search module by paths in sys.path? sys.path is the list of path where the Python interpreter will search modules, yes. how to change it manuallly?"manually" ?-) You mean "dynamically, by code" ? If yes, it''s just a list. You can modify it like you''d do for any other list. Else, you may want to look at the PYTHON_PATH environnement variable. -- bruno desthuilliers python -c "print ''@''.join([''.''.join([w[::-1] for w in p.split(''.'')]) for p in ''o****@xiludom.gro''.split(''@'')])"
yes, I mean I want change the sys.path value and save it for next using. I can change the value of sys.path, but I can''t "save" it permanently. There is no python_path environment on my pc, what the relationship between it and the sys.path? Ju Hui wrote: yes, I mean I want change the sys.path value and save it for next using. I can change the value of sys.path, but I can''t "save" it permanently. There is no python_path environment on my pc, what the relationship between it and the sys.path?In Windows, at least, you can create the PYTHONPATH variable and assign to it the paths of the directories you want Python to check for when running a script.
更多推荐
如何更改sys.path?
发布评论