>> sys.path [''C:\\Python25 \\Progs \\NatLangProc'',''C:\\Python25 \\Lib \\idlelib'',''C:\ \ Windows \\ system32 \\python25.zip'',''C:\\ \\\Python25 \\lib \\site-packages \ \ range'',''C:\\Python25 \\lib \\ site-packages \\\\\ OrangeWidgets'', ''C:\\Python25 \\lib \\site-packages \\\\ \\OrangeCanvas'',''C:\ \Python25 \\DLLs'',''C:\\Python25 \\lib'', ''C:\\Python25 \\lib \\plat-win'', ''C:\\Python25 \\lib\\\ lib-tk'',''C:\\Python25'',''C:\\Python25 \\lib\\site- pac kages'',''C:\\Python25 \\lib\\site-packages \\Numeric'',''C:\\Python25 \ \lib\\site-packages \\PIL'']
>>>
现在我的个人程序在C:/ Python25 / Progs / 如何添加以便我可以导入一些文件从任何地方 解释器中的该目录,它可以从该目录中的其他 文件夹加载文件。
解决方案2008年10月16日17:13,cnb写道: >>> sys.path
[''C:\\Python25 \\ \\\Progs \\NatLangProc'',''C:\\Python25 \\Lib \\idlelib'', ''C:\ \ Windows \\system32 \\python25.zip'',''C:\\Python25 \\lib \\site-packages \ \ range'',''C:\\Python25 \\lib \\site-packages \\\\\ OrangeWidgets'', ''C:\\Python25 \\lib \\site-packages \\\\\ OrangeCanvas'',''C:\ \Python25 \\DLLs'',''C:\\Python25 \\lib'',''C: \\Python25 \\lib \\plat-win'', ''C:\\Python25 \\lib \\lib-tk' ',''C:\\Python25'',''C:\\Python25 \\lib\\site- 包'',''C: \\Python25 \\lib \\site-packages \\Numeric'',''C:\\Python25 \ \lib \\\ \\ site-packages \\PIL'']
>>>>
现在我的个人程序在C:/ Python25 / Progs / 如何添加所以我可以做导入一些文件在任何地方 解释器中的目录,它可以从该目录中的其他 文件夹加载文件。 - mail.python/mailman/listinfo/python-清单
a临时解决方案是将其附加到该列表: sys.path .append(''C:/ Python25 / Progs /'') a永久解决方案是将它添加到环境变量 (不知道在哪里在windows中设置这个)
PYTHONPATH =" / C:/ Python25 / Progs /" gr Arno
9月16日,5:25 * pm,Python< pyt ... @ rgbaz.euwrote: 2008年10月16日17:13,cnb写道: >> sys.path
[''C:\\Python25 \\Progs \\NatLangProc'',''C:\\Python25 \\Lib\\IDLElib'',* ''C:\ \ Windows \\ system32 \\python25.zip'',''C:\\Python25 \\ lib \\site-packages \ \ range'',''C:\\Python25 \\lib \\site-packages \\\ \\\OrangeWidgets'', ''C:\\Python25 \\lib\\site-packages \\\\\OrangeCanvas'',' 'C:\ \Python25 \\DLLs'',''C:\\Python25 \\lib'',''C:\\Python25 \\lib \\plat-win'', ''C:\\Python25 \\lib \\lib-tk'',''C :\\Python25'',''C:\\Python25 \\lib\\site- packages' ,''C:\\Python25 \\lib \\site-packages \\Numeric'',''C:\\Python25 \ \\ \\ lib\\site-packages \\PIL'']
现在我的个人程序在C:/ Python25 / Progs /
如何添加以便我可以执行import somefile在任何地方 解释器中的目录,它可以从该目录中的其他 文件夹加载文件。 - mail.python/mailman/listinfo/python-清单
a临时解决方案是将其附加到该列表: sys.path.append(''C:/ Python25 / Progs /'') a永久解决方案是将它添加到环境变量 (不知道在windows中设置此位置)
>>sys.path [''C:\\Python25\\Progs\\NatLangProc'', ''C:\\Python25\\Lib\\idlelib'', ''C:\ \Windows\\system32\\python25.zip'', ''C:\\Python25\\lib\\site-packages\ \orange'', ''C:\\Python25\\lib\\site-packages\\orange\\OrangeWidgets'', ''C:\\Python25\\lib\\site-packages\\orange\\OrangeCanvas'', ''C:\ \Python25\\DLLs'', ''C:\\Python25\\lib'', ''C:\\Python25\\lib\\plat-win'', ''C:\\Python25\\lib\\lib-tk'', ''C:\\Python25'', ''C:\\Python25\\lib\\site- packages'', ''C:\\Python25\\lib\\site-packages\\Numeric'', ''C:\\Python25\ \lib\\site-packages\\PIL'']
>>>
Now I have my personal programs in C:/Python25/Progs/ How do I add so that I can just do "import somefile" from anywhere in that directory in the interpreter and it can load files from other folders in that directory.
解决方案 On 16 sep 2008, at 17:13, cnb wrote: >>>sys.path
[''C:\\Python25\\Progs\\NatLangProc'', ''C:\\Python25\\Lib\\idlelib'', ''C:\ \Windows\\system32\\python25.zip'', ''C:\\Python25\\lib\\site-packages\ \orange'', ''C:\\Python25\\lib\\site-packages\\orange\\OrangeWidgets'', ''C:\\Python25\\lib\\site-packages\\orange\\OrangeCanvas'', ''C:\ \Python25\\DLLs'', ''C:\\Python25\\lib'', ''C:\\Python25\\lib\\plat-win'', ''C:\\Python25\\lib\\lib-tk'', ''C:\\Python25'', ''C:\\Python25\\lib\\site- packages'', ''C:\\Python25\\lib\\site-packages\\Numeric'', ''C:\\Python25\ \lib\\site-packages\\PIL'']
>>>>
Now I have my personal programs in C:/Python25/Progs/ How do I add so that I can just do "import somefile" from anywhere in that directory in the interpreter and it can load files from other folders in that directory. -- mail.python/mailman/listinfo/python-list
a temp solution is to append it to that list: sys.path.append(''C:/Python25/Progs/'') a permanent solution is to add it to the environment variable (no idea where to set this in windows)
PYTHONPATH = "/C:/Python25/Progs/" gr ArnoOn Sep 16, 5:25*pm, Python <pyt...@rgbaz.euwrote: On 16 sep 2008, at 17:13, cnb wrote: >>sys.path[''C:\\Python25\\Progs\\NatLangProc'', ''C:\\Python25\\Lib\\idlelib'', * ''C:\ \Windows\\system32\\python25.zip'', ''C:\\Python25\\lib\\site-packages\ \orange'', ''C:\\Python25\\lib\\site-packages\\orange\\OrangeWidgets'', ''C:\\Python25\\lib\\site-packages\\orange\\OrangeCanvas'', ''C:\ \Python25\\DLLs'', ''C:\\Python25\\lib'', ''C:\\Python25\\lib\\plat-win'', ''C:\\Python25\\lib\\lib-tk'', ''C:\\Python25'', ''C:\\Python25\\lib\\site- packages'', ''C:\\Python25\\lib\\site-packages\\Numeric'', ''C:\\Python25\ \lib\\site-packages\\PIL'']
Now I have my personal programs in C:/Python25/Progs/
How do I add so that I can just do "import somefile" from anywhere in that directory in the interpreter and it can load files from other folders in that directory. -- mail.python/mailman/listinfo/python-list
a temp solution is to append it to that list: sys.path.append(''C:/Python25/Progs/'') a permanent solution is to add it to the environment variable (no idea where to set this in windows)
更多推荐
如何永久添加到Pythons sys.path?
发布评论