giantbranch/python-hacker-code

关于chapter02中sshcmd.py的运行问题

Closed this issue · 4 comments

为什么在kali linux中可以运行,在windows10下无法运行
错误信息:
D:\Python\black_hat_Python\chapter02>python ssh__command.py
Traceback (most recent call last):
File "ssh__command.py", line 5, in
import paramiko
File "F:\Python27\lib\site-packages\paramiko_init_.py", line 30, in
from paramiko.transport import SecurityOptions, Transport
File "F:\Python27\lib\site-packages\paramiko\transport.py", line 54, in
from paramiko.dsskey import DSSKey
File "F:\Python27\lib\site-packages\paramiko\dsskey.py", line 27, in
from cryptography.hazmat.primitives.asymmetric.utils import (
File "F:\Python27\lib\site-packages\cryptography\hazmat\primitives\asymmetric\utils.py", line 9, in
from asn1crypto.algos import DSASignature
File "F:\Python27\lib\site-packages\asn1crypto\algos.py", line 23, in
from ._int import fill_width
File "F:\Python27\lib\site-packages\asn1crypto_int.py", line 56, in
from ._perf._big_num_ctypes import libcrypto
File "F:\Python27\lib\site-packages\asn1crypto_perf_big_num_ctypes.py", line 31, in
libcrypto_path = find_library('crypto')
File "F:\Python27\lib\ctypes\util.py", line 53, in find_library
fname = os.path.join(directory, name)
File "F:\Python27\lib\ntpath.py", line 85, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd3 in position 2: ordinal not in range(128)

提示编码错误,我不知道哪里错误了

看最后两行,会不会路径的问题

我怀疑是路径编码出错,可是我看不懂ntpath.py源代码,你在windows上运行有报错吗?

我当时是在Windows 7上运行的,没报这个问题

怎么解决的?我也遇到一样的问题,始终不得其解