如何解决 Python 模块检查没有函数 getcallargs
how to address Python module inspect not having function getcallargs
我正在尝试在两个不同的环境中使用模块 inspect
。在其中一个环境中,一切都很好。另一方面,inspect
似乎缺少函数 getcallargs
。我不确定出了什么问题。我也不确定如何检查每个环境中使用的 inspect
的版本。如何让 inspect
在有问题的环境中工作?
正常运行的环境如下:
user1@computer1:~>python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
>>> print inspect.getcallargs
<function getcallargs at 0x7ff122c0a578>
破解的环境如下:
(virtual_environment)-bash-4.1$ python
Python 2.6.6 (r266:84292, Jan 23 2014, 10:39:35)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
>>> print inspect.getcallargs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'getcallargs'
在Python2.6中,inspect模块没有getcallargs函数。
https://docs.python.org/release/2.6/library/inspect.html
Python 2.7 确实有 getcallargs
我正在尝试在两个不同的环境中使用模块 inspect
。在其中一个环境中,一切都很好。另一方面,inspect
似乎缺少函数 getcallargs
。我不确定出了什么问题。我也不确定如何检查每个环境中使用的 inspect
的版本。如何让 inspect
在有问题的环境中工作?
正常运行的环境如下:
user1@computer1:~>python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
>>> print inspect.getcallargs
<function getcallargs at 0x7ff122c0a578>
破解的环境如下:
(virtual_environment)-bash-4.1$ python
Python 2.6.6 (r266:84292, Jan 23 2014, 10:39:35)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
>>> print inspect.getcallargs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'getcallargs'
在Python2.6中,inspect模块没有getcallargs函数。
https://docs.python.org/release/2.6/library/inspect.html
Python 2.7 确实有 getcallargs