我在 CentOS 5.6 下工作。而且我都有
海湾合作委员会(海湾合作委员会(海湾合作委员会)4.1.2 20080704(红帽 4.1.2-52))
和 gcc44(gcc44 (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3))
在/usr/bin/上。
当我执行 pip install -U pyzmq 时,收到以下错误消息:
Downloading/unpacking pyzmq from https://pypi.python.org/packages/source/p/pyzmq/pyzmq-14.3.1.tar.gz#md5=7196b4a6fbf98022f17ffa924be3d68d
Running setup.py egg_info for package pyzmq
no previously-included directories found matching 'docs/build'
no previously-included directories found matching 'docs/gh-pages'
warning: no previously-included files found matching 'bundled/zeromq/src/Makefile*'
warning: no previously-included files found matching 'setup.cfg'
warning: no previously-included files found matching 'zmq/libzmq*'
warning: no previously-included files matching '__pycache__/*' found anywhere in distribution
warning: no previously-included files matching '.deps/*' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.pyd' found anywhere in distribution
warning: no previously-included files matching '.git*' found anywhere in distribution
warning: no previously-included files matching '.DS_Store' found anywhere in distribution
warning: no previously-included files matching '.mailmap' found anywhere in distribution
warning: no previously-included files matching 'Makefile.am' found anywhere in distribution
warning: no previously-included files matching 'Makefile.in' found anywhere in distribution
Installing collected packages: pyzmq
Found existing installation: pyzmq 2.1.11
Uninstalling pyzmq:
Successfully uninstalled pyzmq
Running setup.py install for pyzmq
Using bundled libzmq
already have bundled/zeromq
already have platform.hpp
checking for timer_create
************************************************
************************************************
cc -c /tmp/timer_createbuFGwC.c -o build/temp.linux-x86_64-2.7/tmp/timer_createbuFGwC.o
unable to execute cc: No such file or directory
no timer_create, linking librt
Using bundled libsodium
already have bundled/libsodium
already have version.h
already have crypto_stream_salsa20.h
already have crypto_scalarmult_curve25519.h
************************************************
************************************************
building 'zmq.libsodium' extension
/usr/bin/gcc44 -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DNATIVE_LITTLE_ENDIAN=1 -Ibundled/libsodium/src/libsodium/include -Ibundled/libsodium/src/libsodium/include/sodium -I/opt/python27/include/python2.7 -c buildutils/initlibsodium.c -o build/temp.linux-x86_64-2.7/buildutils/initlibsodium.o
buildutils/initlibsodium.c:10:20: error: Python.h: No such file or directory
buildutils/initlibsodium.c:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Methods’
buildutils/initlibsodium.c:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘initlibzmq’
error: command '/usr/bin/gcc44' failed with exit status 1
Complete output from command /opt/python27/bin/python2.7 -c "import setuptools;__file__='/home/fzeng/build/pyzmq/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-90NjCM-record/install-record.txt:
running install
running build
running build_py
running build_ext
running configure
Using bundled libzmq
already have bundled/zeromq
already have platform.hpp
checking for timer_create
************************************************
************************************************
cc -c /tmp/timer_createbuFGwC.c -o build/temp.linux-x86_64-2.7/tmp/timer_createbuFGwC.o
unable to execute cc: No such file or directory
no timer_create, linking librt
Using bundled libsodium
already have bundled/libsodium
already have version.h
already have crypto_stream_salsa20.h
already have crypto_scalarmult_curve25519.h
************************************************
************************************************
building 'zmq.libsodium' extension
/usr/bin/gcc44 -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DNATIVE_LITTLE_ENDIAN=1 -Ibundled/libsodium/src/libsodium/include -Ibundled/libsodium/src/libsodium/include/sodium -I/opt/python27/include/python2.7 -c buildutils/initlibsodium.c -o build/temp.linux-x86_64-2.7/buildutils/initlibsodium.o
buildutils/initlibsodium.c:10:20: error: Python.h: No such file or directory
buildutils/initlibsodium.c:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Methods’
buildutils/initlibsodium.c:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘initlibzmq’
error: command '/usr/bin/gcc44' failed with exit status 1
----------------------------------------
Rolling back uninstall of pyzmq
Command /opt/python27/bin/python2.7 -c "import setuptools;__file__='/home/fzeng/build/pyzmq/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-90NjCM-record/install-record.txt failed with error code 1 in /home/fzeng/build/pyzmq
Storing complete log in /root/.pip/pip.log
谁能帮我解决这个问题?
最佳答案
我在尝试这个 pip 命令时遇到了完全相同的错误:
pip install "ipython[notebook]
完整错误如下:
/usr/bin/gcc44 -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3
-Wall -Wstrict-prototypes -fPIC -DNATIVE_LITTLE_ENDIAN=1
-Ibundled/libsodium/src/libsodium/include
-Ibundled/libsodium/src/libsodium/include/sodium
-I/opt/python27/include/python2.7 -c buildutils/initlibsodium.c
-o build/temp.linux-x86_64-2.7/buildutils/initlibsodium.o
buildutils/initlibsodium.c:10:20: error: Python.h: No such file or directory
错误提示编译器(gcc44)在/opt/python27/include/python2.7 中找不到头文件Python.h。 (在我的构建中,它正在查找/usr/include/python2.7。)因为我在 Ubuntu 上,这让我走上了寻找我需要安装哪个包以引入 Python 头文件的道路文件。
搜索,I found out我需要安装 python-dev 包。我确定在 yum (CentOS) 中会有相应的包,但在我的 Ubuntu 机器上,我输入:
apt-get install python-dev
在那之后,我在那个包含目录中有了 Python.h,并且我能够完成构建。
关于python-2.7 - pip升级pyzmq时gcc失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25318766/