问题描述
我在新系统上安装了64位Ubuntu 12.04,但无法安装functools.我已经安装了多次,但不记得收到此错误,并且无法通过Google找到任何解决方案.我该怎么办?
I installed Ubuntu 12.04 64 bit on a new system, and cannot install functools. I have installed this multiple times but do not remember getting this error, and cannot find any solution through Google. What do I need to do?
(myvenv)bobs@myvenv:~$ 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
推荐答案
Python2.7附带了functools模块.
Python2.7 comes with the functools module included.
如果要获取Python3.2引入的lru-cache装饰器,可以安装functools32.
You can install functools32 if you want to get the lru-cache decorator, which was introduced with Python3.2.
编辑:我实际上检查了此内容.当我尝试使用Python2.7点子安装functools时,出现了相同的错误.只需执行import functools
并照常进行即可.
I actually checked this. I got the same error when I tried to pip-install functools with Python2.7. Simply do import functools
and proceed as usual.
这篇关于安装functools给我AttributeError'模块'对象没有属性'compose'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!