2

我正在尝试xmlsec在 El Capitan 上安装,但我无法这样做。

我正在按照此页面上的说明进行操作:

https://github.com/concordusapps/python-xmlsec

当我这样做时,pip install xmlsec我得到:

Downloading xmlsec-0.3.1.tar.gz
  Complete output from command python setup.py egg_info:
  no previously-included directories found matching 'doc/.build'

  Installed /private/tmp/easy_install-kotwF5/pkgconfig-1.1.0/.eggs/nose-1.3.7-py2.7.egg
  zip_safe flag not set; analyzing archive contents...

  Installed /private/tmp/pip-build-my91LX/xmlsec/.eggs/pkgconfig-1.1.0-py2.7.egg
  Searching for setuptools-cython
  Reading https://pypi.python.org/simple/setuptools_cython/
  Best match: setuptools-cython 0.2.1
  Downloading https://pypi.python.org/packages/source/s/setuptools_cython/setuptools_cython-0.2.1.tar.gz#md5=c29fc5bf2894e69cbd98e3800cef4707
  Processing setuptools_cython-0.2.1.tar.gz
  Writing /tmp/easy_install-xnAHIU/setuptools_cython-0.2.1/setup.cfg
  Running setuptools_cython-0.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-xnAHIU/setuptools_cython-0.2.1/egg-dist-tmp-zk1125
  zip_safe flag not set; analyzing archive contents...
  Copying setuptools_cython-0.2.1-py2.7.egg to /private/tmp/pip-build-my91LX/xmlsec/.eggs

  Installed /private/tmp/pip-build-my91LX/xmlsec/.eggs/setuptools_cython-0.2.1-py2.7.egg
  Searching for Cython
  Reading https://pypi.python.org/simple/Cython/
  Traceback (most recent call last):
    File "<string>", line 20, in <module>
    File "/private/tmp/pip-build-my91LX/xmlsec/setup.py", line 121, in <module>
      make_extension('xmlsec.template'),
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup
      _setup_distribution = dist = klass(attrs)
    File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 268, in __init__
      self.fetch_build_eggs(attrs['setup_requires'])
    File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 313, in fetch_build_eggs
      replace_conflicting=True,
    File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 836, in resolve
      dist = best[req.key] = env.best_match(req, ws, installer)
    File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1081, in best_match
      return self.obtain(req, installer)
    File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1093, in obtain
      return installer(requirement)
    File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 380, in fetch_build_egg
      return cmd.easy_install(req)
    File "/usr/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 626, in easy_install
      not self.always_copy, self.local_index
    File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 590, in fetch_distribution
      self.find_packages(requirement)
    File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 427, in find_packages
      self.scan_url(self.index_url + requirement.unsafe_name+'/')
    File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 761, in scan_url
      self.process_url(url, True)
    File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 304, in process_url
      f = self.open_url(url, "Download error on %s: %%s -- Some packages may not be found!" % url)
    File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 700, in open_url
      return open_with_auth(url, self.opener)
    File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 894, in _socket_timeout
      return func(*args, **kwargs)
    File "/usr/local/lib/python2.7/site-packages/setuptools/package_index.py", line 1007, in open_with_auth
      fp = opener(request)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
      return opener.open(url, data, timeout)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 437, in open
      response = meth(req, response)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 550, in http_response
      'http', request, response, code, msg, hdrs)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 469, in error
      result = self._call_chain(*args)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
      result = func(*args)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 656, in http_error_302
      return self.parent.open(new, timeout=req.timeout)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 437, in open
      response = meth(req, response)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 550, in http_response
      'http', request, response, code, msg, hdrs)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 469, in error
      result = self._call_chain(*args)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
      result = func(*args)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 656, in http_error_302
      return self.parent.open(new, timeout=req.timeout)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
      response = self._open(req, data)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
      '_open', req)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
      result = func(*args)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open
      context=self._context)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1200, in do_open
      r = h.getresponse(buffering=True)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1132, in getresponse
      response.begin()
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 453, in begin
      version, status, reason = self._read_status()
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 409, in _read_status
      line = self.fp.readline(_MAXLINE + 1)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 480, in readline
      data = self._sock.recv(self._rbufsize)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 734, in recv
      return self.read(buflen)
    File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 621, in read
      v = self._sslobj.read(len or 1024)
  ssl.SSLError: ('The read operation timed out',)

  ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-my91LX/xmlsec

当我下载源代码并手动执行时,我得到:

Processing /Users/myuser/python-xmlsec
Requirement already satisfied (use --upgrade to upgrade): lxml>=3.0 in /usr/local/lib/python2.7/site-packages (from xmlsec==0.1.2)
Installing collected packages: xmlsec
  Running setup.py install for xmlsec
    Complete output from command /usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-ad8Fqh-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-X7VjyO-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.11-x86_64-2.7
    creating build/lib.macosx-10.11-x86_64-2.7/xmlsec
    copying src/xmlsec/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/xmlsec
    copying src/xmlsec/meta.py -> build/lib.macosx-10.11-x86_64-2.7/xmlsec
    running build_ext
    cythoning src/xmlsec/constants.pyx to src/xmlsec/constants.c
    building 'xmlsec.constants' extension
    creating build/temp.macosx-10.11-x86_64-2.7
    creating build/temp.macosx-10.11-x86_64-2.7/src
    creating build/temp.macosx-10.11-x86_64-2.7/src/xmlsec
    clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/lib/python2.7/site-packages/lxml -I/usr/local/lib/python2.7/site-packages/lxml/includes -Isrc -I/usr/local/Cellar/libxml2/2.9.2/include/libxml2 -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/xmlsec/constants.c -o build/temp.macosx-10.11-x86_64-2.7/src/xmlsec/constants.o
    In file included from src/xmlsec/constants.c:256:
    src/xmlsec.h:1:10: fatal error: 'xmlsec/crypto.h' file not found
    #include <xmlsec/crypto.h>
             ^
    1 error generated.
    error: command 'clang' failed with exit status 1

    ----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-ad8Fqh-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-X7VjyO-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-ad8Fqh-build

有什么我想念的吗?

4

2 回答 2

9

这终于奏效了:

brew install -v libxmlsec1

显然这是在 macOS 上使用自制软件。

于 2015-10-01T16:06:09.887 回答
2

在 OSX 10.14 上安装(或重新安装)limbxmlsec1 对我不起作用。这是我必须做的:

  1. xcode 附带了一些 SDK 头文件。将它们复制到桌面:
cp /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg ~/Desktop
  1. 通过双击安装包,或运行以下命令:
sudo installer -pkg ~/Desktop/macOS_SDK_headers_for_macOS_10.14.pkg -target /
  1. 再次尝试安装:
pip install xmlsec
于 2019-03-14T01:13:26.440 回答