mac上的paramiko软件包1.4.1上的安装错误

时间:2017-02-22 16:27:56

标签: python ssh cryptography paramiko

我最近尝试使用paramiko运行一段代码,代码只是构建一个基本的ssh端口,代码可以在其他机器上使用。但是,当我安装paramiko并在我自己的机器上运行代码时,它无法正常工作。我仔细检查了代码,以确保它是相同的。然后我在编译时检查了错误,它说:

post "/checkphone" => "phones#checkphone"
  post "/checksim" => "phones#checksim"

  resources :phones, path: '4g-promo'

我在网上寻找答案,它说我可能遇到的问题是我没有加密1.4.1软件包。因此,我使用pip来安装软件包,由于某种原因,我收到了与运行程序相同的错误。

    import paramiko
  File "/Library/Python/2.7/site-packages/paramiko/__init__.py", line 30, in <module>
    from paramiko.transport import SecurityOptions, Transport
  File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 33, in <module>
    from cryptography.hazmat.backends import default_backend
  File "/Library/Python/2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
    import pkg_resources
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 72, in <module>
    import packaging.requirements
  File "/Library/Python/2.7/site-packages/packaging/requirements.py", line 59, in <module>
    MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
  TypeError: __call__() takes exactly 2 arguments (1 given)

所以有人都知道我的机器会发生什么事吗?在安装加密之前,我还需要安装其他任何软件包吗?

我目前正在使用mac OS Y Yosemite,我的pip已升级。

********更新********************* ********

这是原始代码:

pip install crypto
Collecting crypto
  Using cached crypto-1.4.1-py2.py3-none-any.whl
Collecting shellescape (from crypto)
  Using cached shellescape-3.4.1-py2.py3-none-any.whl
Collecting Naked (from crypto)
  Using cached Naked-0.1.31-py2.py3-none-any.whl
Collecting requests (from Naked->crypto)
  Using cached requests-2.13.0-py2.py3-none-any.whl
Collecting pyyaml (from Naked->crypto)
  Using cached PyYAML-3.12.tar.gz
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 335, in run
    wb.build(autobuilding=True)
  File "/Library/Python/2.7/site-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 634, in _prepare_file
    abstract_dist.prep_for_dist()
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 129, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 412, in run_egg_info
    self.setup_py, self.name,
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 387, in setup_py
    import setuptools  # noqa
  File "/Library/Python/2.7/site-packages/setuptools/__init__.py", line 12, in <module>
    import setuptools.version
  File "/Library/Python/2.7/site-packages/setuptools/version.py", line 1, in <module>
    import pkg_resources
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 72, in <module>
    import packaging.requirements
  File "/Library/Python/2.7/site-packages/packaging/requirements.py", line 59, in <module>
    MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)

希望这会有所帮助!

关于版本问题,我只是尝试使用pip来安装pycrypto(版本为2.6.1),同样的错误也会引发。

感谢您提前给予的大力帮助和耐心, 彼得

1 个答案:

答案 0 :(得分:0)

嘿,我遇到了同样的问题。 我尝试了以下说明,它的工作原理! (来自https://bugs.centos.org/view.php?id=12722&history=1的ptmcg)

  

包装模块的requirements.py中的这一行:

MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")

使用pyparsing 2.0.2中引入的功能,特别是使用&#34; expr()&#34;复制表达式,在这种情况下&#34; MARKER_EXPR()&#34;。升级到pyparsing 2.1.10(最新版本)是建议的操作过程,但也可以通过将requirements.py中的代码更改为:

来解决此问题。
MARKER_EXPR = originalTextFor(MARKER_EXPR)("marker")

(在这一行中,实际上不需要复制MARKER_EXPR。)