1

我正在阅读python 教程,似乎缺少一些非常基本的东西。该教程有:

>>> 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.

这是安装错误吗?

4

1 回答 1

2

根据文档,这个特性/功能是在 python2.7 中添加的——你仍然在 python 2.6

于 2013-02-11T02:55:55.853 回答