51Testing软件测试论坛

标题: 遇见个难题,关于python的,希望各位能够帮忙解答 [打印本页]

作者: 茄子树上结苹果    时间: 2017-8-5 09:41
标题: 遇见个难题,关于python的,希望各位能够帮忙解答
我装的python环境的paramiko包突然间就不能用,导入总是报错,以前都没有问题,重装了python环境、重新安装paramiko包都不行,不知道时什么原因,报错如下:
C:\Users\Administrator>python
Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\python27\lib\site-packages\paramiko\__init__.py", line 31, in <module>
    from paramiko.transport import SecurityOptions, Transport
  File "C:\python27\lib\site-packages\paramiko\transport.py", line 56, in <module>
    from paramiko.dsskey import DSSKey
  File "C:\python27\lib\site-packages\paramiko\dsskey.py", line 27, in <module>
    from cryptography.hazmat.primitives.asymmetric.utils import (
  File "C:\python27\lib\site-packages\cryptography\hazmat\primitives\asymmetric\utils.py", line 9, in <module>
    from asn1crypto.algos import DSASignature
  File "C:\python27\lib\site-packages\asn1crypto\algos.py", line 23, in <module>
    from ._int import fill_width
  File "C:\python27\lib\site-packages\asn1crypto\_int.py", line 56, in <module>
    from ._perf._big_num_ctypes import libcrypto
  File "C:\python27\lib\site-packages\asn1crypto\_perf\_big_num_ctypes.py", line 31, in <module>
    libcrypto_path = find_library('crypto')
  File "C:\python27\lib\ctypes\util.py", line 54, in find_library
    fname = os.path.join(directory, name)
  File "C:\python27\lib\ntpath.py", line 108, in join
    path += "\\" + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 6: ordinal not in range(128)

作者: fhhh_eyou    时间: 2017-8-5 09:41
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 6: ordinal not in range(128)

字符转换出错,安装时,去掉-,/,.,
File "C:\python27\lib\site-packages\paramiko\__init__.py", line 31, in <module>
等等.
作者: libingyu135    时间: 2017-8-7 09:49
检查下环境变量?
作者: jenery    时间: 2017-8-7 10:02
字符编码环境问题,import sys看看
作者: jenery    时间: 2017-8-7 10:04
重新安装一遍paraMIko的包
作者: jenery    时间: 2017-8-7 10:06
http://blog.csdn.net/zhangfeng1133/article/details/51509169
作者: Real_小T    时间: 2017-8-7 11:34
你先试试这样 打开你C:\python27\lib\ntpath.py这个文件 找一下def join这个方法 然后在方法内的第一行加入这个:
  1. reload(sys)
  2. sys.setdefaultencoding('utf-8')
复制代码





欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2