1
  # python
  enter code herePython 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
  [GCC 4.4.3] on linux2
   Type "help", "copyright", "credits" or "license" for more information.
  >>> import os,sys
  >>> import setup
  ..........
  ..........
  ..........
 >>> reload(setup)
 <module 'setup' from 'setup.pyc'>
 >>>

But after executing reload its not taking updated 'setup' module

For example: Doing some change in 'setup' file in another session and reloading in interpreter mode. But unable to use updated 'setup'

Could any will help me, how to overcome from this issue or where i am doing wrong

Thanks in Advance Abhishek

4

2 回答 2

3

reload重新加载一个模块,但不重新编译它。

>>> reload(setup)
<module 'setup' from 'setup.pyc'>

它是从编译后重新加载的setup.pyc,而不是setup.py. setup.pyc解决此问题的最简单方法是在进行更改后简单地删除。然后当它重新加载时setup.py,它将首先重新编译它。

于 2012-12-14T11:38:25.570 回答
1

尝试将返回的值分配给reload同一个变量:

setup = reload(setup)
于 2012-12-14T11:42:37.257 回答