'module'对象没有'getusersitepackages'属性

时间:2013-02-11 02:54:10

标签: python cygwin

我正在经历python tutorial并且似​​乎缺少一些非常基本的东西。该教程有:

>>> import site
>>> site.getusersitepackages()
'/home/user/.local/lib/python3.2/site-packages'

但我得到以下内容:

$ python
Python 2.6.8 (unknown, Jun  9 2012, 11:30:32) 
[GCC 4.5.3] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>> site.getusersitepackages()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'getusersitepackages'

如上所述,我正在Python 2.6.8上运行cygwin

这是安装错误吗?

1 个答案:

答案 0 :(得分:2)

According to the docs,在python2.7中添加了这个特性/功能 - 你还在python 2.6上