安装错误1.4.1 MAC
最近,我试图用的paramiko运行一段代码,代码简单地建立一个基本的SSH端口和代码可在其他机器上。但是,当我安装paramiko并在我自己的机器上运行代码时,它不起作用。我仔细检查了代码,以确保它是相同的。然后,我在编译时检查错误,它说:安装错误1.4.1 MAC
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)
我在网上seeked答案,并表示,可能出现的问题可能我是,我没有加密1.4.1包。因此,我使用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)
那么有人知道我的机器正在发生什么吗?在我安装crypto之前是否还有其他软件包需要安装?
我目前使用的Mac OSÿ优山美地和我的点子升级。
*************************更新******************** *********
这是原来的代码:
import threading
import paramiko
import subprocess
def ssh_command(ip,user,passwd,command):
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(ip,username = user, password = passwd)
ssh_session = client.get_transport().open_session()
if ssh_session.active:
ssh_session.exec_command(command)
print ssh_session.recv(1024)
return
ssh_command('192.168.100.301','GLZ','TripleBody','id')
希望这将有助于!
也即将版本的问题,我只是用PIP安装pycrypto(这是2.6.1版本),并同样的错误引起了尝试。
感谢您的大力帮助和耐心提前, 彼得
嘿,我得到了同样的问题。 我试过下面的说明,它的工作原理! (从https://bugs.centos.org/view.php?id=12722&history=1 ptmcg提供)
这条线在包装模块的requirements.py:
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
使用已在pyparsing 2.0.2引入的功能,具体地使用“ expr()“来复制表达式,在这种情况下是”MARKER_EXPR()“。升级到2.1.10 pyparsing(最新版本)是行动的建议过程中,但是这也可以通过改变代码requirements.py固定:
MARKER_EXPR = originalTextFor(MARKER_EXPR)("marker")
(在这条线,它实际上不是必要的使MARKER_EXPR的副本。)
你好PetaGlz ..如果我的答案可以帮助你,你介意给我一个upvote?谢谢! – mopkaloppt
对不起,先生,我不熟悉堆栈溢出,我没有经常检查我的帐户。当我试图给你一个upvote时,它说我不能,再次为此抱歉。 – PetaGlz
你尝试安装最新版本的密码的?它是2.6.1 – haifzhan
你能否也提供代码? – progNewbie
我刚刚编辑的问题,希望这会有所帮助〜 – PetaGlz