茄子树上结苹果 发表于 2017-8-5 09:41:19

遇见个难题,关于python的,希望各位能够帮忙解答

我装的python环境的paramiko包突然间就不能用,导入总是报错,以前都没有问题,重装了python环境、重新安装paramiko包都不行,不知道时什么原因,报错如下:
C:\Users\Administrator>python
Python 2.7.6 (default, Nov 10 2013, 19:24:24) 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:20

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:46

检查下环境变量?

jenery 发表于 2017-8-7 10:02:13

字符编码环境问题,import sys看看

jenery 发表于 2017-8-7 10:04:39

重新安装一遍paraMIko的包

jenery 发表于 2017-8-7 10:06:19

http://blog.csdn.net/zhangfeng1133/article/details/51509169

Real_小T 发表于 2017-8-7 11:34:12

你先试试这样 打开你C:\python27\lib\ntpath.py这个文件 找一下def join这个方法 然后在方法内的第一行加入这个:
reload(sys)
sys.setdefaultencoding('utf-8')
页: [1]
查看完整版本: 遇见个难题,关于python的,希望各位能够帮忙解答