安装 PyPI xmlsec==1.3.3 时出错 Python2
Error installing PyPI xmlsec==1.3.3 Python2
我正在使用 arch 并在 virtualenv (python 2.7)
中使用 pip 20.3.4 安装这个 xmlsec 包
虽然官方页面(github 和 pypi)没有特别包含 arch 依赖项,但我仍然认为我已经安装了所有这些。
我已经安装:
extra/xmlsec 1.2.32-1 [installed]
community/python-xmlsec 1.3.11-1 [installed]
extra/libxml2 2.9.10-9 [installed]
extra/libxml++ 3.2.3-1 [installed]
multilib/lib32-libxml2 2.9.10-4 [installed]
我的gcc版本是11.1.0
我收到这个错误:
Requirement already satisfied: pkgconfig in ./cen/lib/python2.7/site-packages (from xmlsec==1.3.3) (1.5.2)
Requirement already satisfied: lxml>=3.0 in ./cen/lib/python2.7/site-packages (from xmlsec==1.3.3) (4.0.0)
Building wheels for collected packages: xmlsec
Building wheel for xmlsec (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/astanwar99/DevSpace/central/cen/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-E6BWHU/xmlsec/setup.py'"'"'; __file__='"'"'/tmp/pip-install-E6BWHU/xmlsec/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-y4lh42
cwd: /tmp/pip-install-E6BWHU/xmlsec/
Complete output (53 lines):
running bdist_wheel
running build
running build_ext
building 'xmlsec' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/tmp
creating build/temp.linux-x86_64-2.7/tmp/pip-install-E6BWHU
creating build/temp.linux-x86_64-2.7/tmp/pip-install-E6BWHU/xmlsec
creating build/temp.linux-x86_64-2.7/tmp/pip-install-E6BWHU/xmlsec/src
gcc -pthread -fno-strict-aliasing -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fPIC -DMODULE_NAME=xmlsec -DMODULE_VERSION=1.3.3 -DXMLSEC_CRYPTO_DY.....
.
.
In file included from /tmp/pip-install-E6BWHU/xmlsec/src/constants.c:10:
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c: In function ‘PyXmlSec_ConstantsModule_Init’:
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c:278:50: error: ‘xmlSecXkmsNs’ undeclared (first use in this function); did you mean ‘xmlSecXPathNs’?
278 | tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
| ^~~~~~
/tmp/pip-install-E6BWHU/xmlsec/src/common.h:21:23: note: in definition of macro ‘DO_JOIN2’
21 | #define DO_JOIN2(X,Y) X##Y
| ^
/tmp/pip-install-E6BWHU/xmlsec/src/common.h:19:19: note: in expansion of macro ‘DO_JOIN1’
19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
| ^~~~~~~~
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c:278:45: note: in expansion of macro ‘JOIN’
278 | tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
| ^~~~
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c:288:5: note: in expansion of macro ‘PYXMLSEC_ADD_NS_CONSTANT’
288 | PYXMLSEC_ADD_NS_CONSTANT(XkmsNs, "XKMS");
| ^~~~~~~~~~~~~~~~~~~~~~~~
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c:278:50: note: each undeclared identifier is reported only once for each function it appears in
278 | tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
| ^~~~~~
/tmp/pip-install-E6BWHU/xmlsec/src/common.h:21:23: note: in definition of macro ‘DO_JOIN2’
21 | #define DO_JOIN2(X,Y) X##Y
| ^
/tmp/pip-install-E6BWHU/xmlsec/src/common.h:19:19: note: in expansion of macro ‘DO_JOIN1’
19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
| ^~~~~~~~
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c:278:45: note: in expansion of macro ‘JOIN’
278 | tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
| ^~~~
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c:288:5: note: in expansion of macro ‘PYXMLSEC_ADD_NS_CONSTANT’
288 | PYXMLSEC_ADD_NS_CONSTANT(XkmsNs, "XKMS");
| ^~~~~~~~~~~~~~~~~~~~~~~~
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for xmlsec
Running setup.py clean for xmlsec
Failed to build xmlsec
Installing collected packages: xmlsec
Running setup.py install for xmlsec ... error
ERROR: Command errored out with exit status 1:
感谢大家的帮助。
XMLSec's PyPI page 说最新版本的库只兼容 Python 3.
看起来 version 1.3.9 仍然声称 Python 2 兼容性,因此您可能想尝试一下
pip install xmlsec==1.3.9
或者,你知道,更好的是,切换到 Python 3.
我能够解决这个问题。
- 克隆这个 repo https://github.com/mehcode/python-xmlsec
- 查看此 commit(python 2.7 仍受支持)
- 手动更改 commit。
- pip 安装。
我正在使用 arch 并在 virtualenv (python 2.7)
中使用 pip 20.3.4 安装这个 xmlsec 包
虽然官方页面(github 和 pypi)没有特别包含 arch 依赖项,但我仍然认为我已经安装了所有这些。
我已经安装:
extra/xmlsec 1.2.32-1 [installed]
community/python-xmlsec 1.3.11-1 [installed]
extra/libxml2 2.9.10-9 [installed]
extra/libxml++ 3.2.3-1 [installed]
multilib/lib32-libxml2 2.9.10-4 [installed]
我的gcc版本是11.1.0
我收到这个错误:
Requirement already satisfied: pkgconfig in ./cen/lib/python2.7/site-packages (from xmlsec==1.3.3) (1.5.2)
Requirement already satisfied: lxml>=3.0 in ./cen/lib/python2.7/site-packages (from xmlsec==1.3.3) (4.0.0)
Building wheels for collected packages: xmlsec
Building wheel for xmlsec (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/astanwar99/DevSpace/central/cen/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-E6BWHU/xmlsec/setup.py'"'"'; __file__='"'"'/tmp/pip-install-E6BWHU/xmlsec/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-y4lh42
cwd: /tmp/pip-install-E6BWHU/xmlsec/
Complete output (53 lines):
running bdist_wheel
running build
running build_ext
building 'xmlsec' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/tmp
creating build/temp.linux-x86_64-2.7/tmp/pip-install-E6BWHU
creating build/temp.linux-x86_64-2.7/tmp/pip-install-E6BWHU/xmlsec
creating build/temp.linux-x86_64-2.7/tmp/pip-install-E6BWHU/xmlsec/src
gcc -pthread -fno-strict-aliasing -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fPIC -DMODULE_NAME=xmlsec -DMODULE_VERSION=1.3.3 -DXMLSEC_CRYPTO_DY.....
.
.
In file included from /tmp/pip-install-E6BWHU/xmlsec/src/constants.c:10:
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c: In function ‘PyXmlSec_ConstantsModule_Init’:
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c:278:50: error: ‘xmlSecXkmsNs’ undeclared (first use in this function); did you mean ‘xmlSecXPathNs’?
278 | tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
| ^~~~~~
/tmp/pip-install-E6BWHU/xmlsec/src/common.h:21:23: note: in definition of macro ‘DO_JOIN2’
21 | #define DO_JOIN2(X,Y) X##Y
| ^
/tmp/pip-install-E6BWHU/xmlsec/src/common.h:19:19: note: in expansion of macro ‘DO_JOIN1’
19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
| ^~~~~~~~
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c:278:45: note: in expansion of macro ‘JOIN’
278 | tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
| ^~~~
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c:288:5: note: in expansion of macro ‘PYXMLSEC_ADD_NS_CONSTANT’
288 | PYXMLSEC_ADD_NS_CONSTANT(XkmsNs, "XKMS");
| ^~~~~~~~~~~~~~~~~~~~~~~~
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c:278:50: note: each undeclared identifier is reported only once for each function it appears in
278 | tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
| ^~~~~~
/tmp/pip-install-E6BWHU/xmlsec/src/common.h:21:23: note: in definition of macro ‘DO_JOIN2’
21 | #define DO_JOIN2(X,Y) X##Y
| ^
/tmp/pip-install-E6BWHU/xmlsec/src/common.h:19:19: note: in expansion of macro ‘DO_JOIN1’
19 | #define JOIN(X,Y) DO_JOIN1(X,Y)
| ^~~~~~~~
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c:278:45: note: in expansion of macro ‘JOIN’
278 | tmp = PyString_FromString((const char*)(JOIN(xmlSec, name))); \
| ^~~~
/tmp/pip-install-E6BWHU/xmlsec/src/constants.c:288:5: note: in expansion of macro ‘PYXMLSEC_ADD_NS_CONSTANT’
288 | PYXMLSEC_ADD_NS_CONSTANT(XkmsNs, "XKMS");
| ^~~~~~~~~~~~~~~~~~~~~~~~
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for xmlsec
Running setup.py clean for xmlsec
Failed to build xmlsec
Installing collected packages: xmlsec
Running setup.py install for xmlsec ... error
ERROR: Command errored out with exit status 1:
感谢大家的帮助。
XMLSec's PyPI page 说最新版本的库只兼容 Python 3.
看起来 version 1.3.9 仍然声称 Python 2 兼容性,因此您可能想尝试一下
pip install xmlsec==1.3.9
或者,你知道,更好的是,切换到 Python 3.
我能够解决这个问题。
- 克隆这个 repo https://github.com/mehcode/python-xmlsec
- 查看此 commit(python 2.7 仍受支持)
- 手动更改 commit。
- pip 安装。