2013-07-26 65 views
8

我在一個新系統上安裝了Ubuntu 12.04 64位,並且無法安裝functools。我已經安裝了多次,但不記得得到這個錯誤,並且找不到任何通過Google的解決方案。我需要做什麼?安裝functools給我AttributeError'模塊'對象沒有屬性'撰寫'

(myvenv)[email protected]:~$ pip install functools 
Downloading/unpacking functools 
    Downloading functools-0.5.tar.gz 
    Running setup.py egg_info for package functools 
    Traceback (most recent call last): 
     File "<string>", line 3, in <module> 
     File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/__init__.py", line 2, in <module> 
     from setuptools.extension import Extension, Library 
     File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/extension.py", line 5, in <module> 
     from setuptools.dist import _get_unpatched 
     File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/dist.py", line 10, in <module> 
     from setuptools.compat import numeric_types, basestring 
     File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/compat.py", line 17, in <module> 
     import httplib 
     File "/usr/lib/python2.7/httplib.py", line 71, in <module> 
     import socket 
     File "/usr/lib/python2.7/socket.py", line 49, in <module> 
     from functools import partial 
     File "functools.py", line 72, in <module> 
     globals()['c_%s' % x] = globals()[x] = getattr(_functools, x) 
    AttributeError: 'module' object has no attribute 'compose' 
    Complete output from command python setup.py egg_info: 
    Traceback (most recent call last): 

    File "<string>", line 3, in <module> 

    File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/__init__.py", line 2, in <module> 

    from setuptools.extension import Extension, Library 

    File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/extension.py", line 5, in <module> 

    from setuptools.dist import _get_unpatched 

    File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/dist.py", line 10, in <module> 

    from setuptools.compat import numeric_types, basestring 

    File "/home/bobs/.virtualenvs/myvenv/local/lib/python2.7/site-packages/setuptools/compat.py", line 17, in <module> 

    import httplib 

    File "/usr/lib/python2.7/httplib.py", line 71, in <module> 

    import socket 

    File "/usr/lib/python2.7/socket.py", line 49, in <module> 

    from functools import partial 

    File "functools.py", line 72, in <module> 

    globals()['c_%s' % x] = globals()[x] = getattr(_functools, x) 

AttributeError: 'module' object has no attribute 'compose' 

---------------------------------------- 
Cleaning up... 
Command python setup.py egg_info failed with error code 1 in /home/bobs/.virtualenvs/myvenv/build/functools 
Storing complete log in /home/bobs/.pip/pip.log 

回答

7

Python2.7附帶了functools模塊。

如果你想獲得使用Python3.2引入的lru-cache裝飾器,你可以安裝functools32。

編輯:我真的檢查過這個。當我嘗試使用Python2.7來安裝functools時,我得到了同樣的錯誤。只需執行import functools並照常進行。

0

在windows上有一個解決方案。

  1. 在站點包文件夾中刪除任何對functools的引用。
  2. easy_install -U pip==7.1.2
相關問題