>>> import sys
>>> sys.path
[
'', 'C:\\Python26\\python26.zip', 'C:\\Python26\\DLLs', 'C:\\Python26\\lib', 'C
:\\Python26\\lib\\plat-win', 'C:\\Python26\\lib\\lib-tk', 'C:\\Python26', 'C:\\P
ython26\\lib\\site
-packages']
>>> sys
<module 'sys' (built-in)>
>>> sys.path.append('D:\svnTest')
>>> sys.path
[
'', 'C:\\Python26\\python26.zip', 'C:\\Python26\\DLLs', 'C:\\Python26\\lib', 'C
:\\Python26\\lib\\plat-win', 'C:\\Python26\\lib\\lib-tk', 'C:\\Python26', 'C:\\P
ython26\\lib\\site
-packages', 'D:\\svnTest']

Notes:

  1. Importing the Sys module makes all of its functions and attributes available
  2. You can add a new directory to Python's search path at runtime by appending the directory name to sys.path, and then Python will look in that directory as well, whenever you try to import a module. The effect lasts as long as Python is running.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
  • 2022-01-10
  • 2021-08-03
  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-14
  • 2022-01-15
  • 2021-06-06
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2021-06-19
相关资源
相似解决方案