我正在尝试在我的Ubuntu 15.10 PC上设置虚拟环境。在我的主目录中,我运行了以下命令:
virtualenv python
source python/bin/activate
pip install ujson
以下是~/.pip/pip.log
的内容(下半部分):
running build
running build_ext
building 'ujson' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/python
creating build/temp.linux-x86_64-2.7/lib
distcc clang-3.7 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./python/ujson.c -o build/temp.linux-x86_64-2.7/./python/ujson.o -D_GNU_SOURCE
distcc clang-3.7 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./python/objToJSON.c -o build/temp.linux-x86_64-2.7/./python/objToJSON.o -D_GNU_SOURCE
distcc clang-3.7 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./python/JSONtoObj.c -o build/temp.linux-x86_64-2.7/./python/JSONtoObj.o -D_GNU_SOURCE
distcc clang-3.7 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./lib/ultrajsonenc.c -o build/temp.linux-x86_64-2.7/./lib/ultrajsonenc.o -D_GNU_SOURCE
distcc clang-3.7 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./lib/ultrajsondec.c -o build/temp.linux-x86_64-2.7/./lib/ultrajsondec.o -D_GNU_SOURCE
creating build/lib.linux-x86_64-2.7
gcc -pthread -shared build/temp.linux-x86_64-2.7/./python/ujson.o build/temp.linux-x86_64-2.7/./python/objToJSON.o build/temp.linux-x86_64-2.7/./python/JSONtoObj.o build/temp.linux-x86_64-2.7/./lib/ultrajsonenc.o build/temp.linux-x86_64-2.7/./lib/ultrajsondec.o -L/usr/lib -lpython2.7 -o build/lib.linux-x86_64-2.7/ujson.so
running install_lib
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-v2tojT/ujson/setup.py", line 69, in <module>
classifiers=CLASSIFIERS,
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/quant/python/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib/python2.7/distutils/command/install.py", line 575, in run
self.run_command(cmd_name)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 971, in run_command
cmd_obj.ensure_finalized()
File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/home/quant/python/lib/python2.7/site-packages/setuptools/command/install_lib.py", line 17, in finalize_options
self.set_undefined_options('install',('install_layout','install_layout'))
File "/usr/lib/python2.7/distutils/cmd.py", line 302, in set_undefined_options
getattr(src_cmd_obj, src_option))
File "/usr/lib/python2.7/distutils/cmd.py", line 105, in __getattr__
raise AttributeError, attr
AttributeError: install_layout
----------------------------------------
Cleaning up...
Command /home/quant/python/bin/python2 -c "import setuptools, tokenize;__file__='/tmp/pip-build-v2tojT/ujson/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rkdmJT-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/quant/python/include/site/python2.7 failed with error code 1 in /tmp/pip-build-v2tojT/ujson
Exception information:
Traceback (most recent call last):
File "/home/quant/python/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/home/quant/python/lib/python2.7/site-packages/pip/commands/install.py", line 309, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/home/quant/python/lib/python2.7/site-packages/pip/req.py", line 1436, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/home/quant/python/lib/python2.7/site-packages/pip/req.py", line 707, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/home/quant/python/lib/python2.7/site-packages/pip/util.py", line 716, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command /home/quant/python/bin/python2 -c "import setuptools, tokenize;__file__='/tmp/pip-build-v2tojT/ujson/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rkdmJT-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/quant/python/include/site/python2.7 failed with error code 1 in /tmp/pip-build-v2tojT/ujson
一些可能有用的信息:
(python)quant@OptiPlex-990:~$ pip --version
pip 1.5.6 from /home/quant/python/lib/python2.7/site-packages (python 2.7)
(python)quant@OptiPlex-990:~$ which python
/home/quant/python/bin/python
(python)quant@OptiPlex-990:~$ python --version
Python 2.7.10
我已尝试安装其他类似的结果包(例如numpy
);编译完成,但在尝试运行install_lib
时会爆炸。
答案 0 :(得分:23)
您是否尝试过更新setuptools?
pip install -U setuptools
然后:
pip install ujson
答案 1 :(得分:6)
这可能是“ setuptools”过时的问题。
pip install --upgrade setuptools
应该解决问题。
答案 2 :(得分:-4)
我更新到Ubuntu 16.04,并且在修改了virtualenv并从头开始之后,再没有看到这个问题。