我是靠谱客的博主 霸气月光,最近开发中收集的这篇文章主要介绍【记录】paramiko安装问题解决方案,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

原文链接:https://blog.csdn.net/wangying202/article/details/109486339

paramiko安装

我当电脑安装的是python3.6.5版本,需要安装paramiko进行远程服务器操作所以选择安装paramiko模块。

通过命令:pip install paramiko进行安装报错,报错内容如下:


Running setup.py install for bcrypt ... error
Complete output from command D:workwy_onlyrobot_fwvenvScriptspython.exe -u -c "import setuptools, tokenize;__file__='C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-zg20xq06\bcrypt\setup.py';f=getattr(tokenize,
'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersADMINI~1AppDataLocalTemppip-record-jy1fhtl0install-record.txt --single-version-externally-
managed --compile --install-headers D:workwy_onlyrobot_fwvenvincludesitepython3.6bcrypt:
running install
running build
running build_py
creating build
creating buildlib.win-amd64-3.6
creating buildlib.win-amd64-3.6bcrypt
copying srcbcrypt__about__.py -> buildlib.win-amd64-3.6bcrypt
copying srcbcrypt__init__.py -> buildlib.win-amd64-3.6bcrypt
copying srcbcryptpy.typed -> buildlib.win-amd64-3.6bcrypt
running build_ext
generating cffi module 'build\temp.win-amd64-3.6\Release\_bcrypt.c'
creating buildtemp.win-amd64-3.6
creating buildtemp.win-amd64-3.6Release
building '_bcrypt' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
Command "D:workwy_onlyrobot_fwvenvScriptspython.exe -u -c "import setuptools, tokenize;__file__='C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-zg20xq06\bcrypt\setup.py';f=getattr(tokenize, 'open', open)(__file__);
code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersADMINI~1AppDataLocalTemppip-record-jy1fhtl0install-record.txt --single-version-externally-managed --compile --inst
all-headers D:workwy_onlyrobot_fwvenvincludesitepython3.6bcrypt" failed with error code 1 in C:UsersADMINI~1AppDataLocalTemppip-install-zg20xq06bcrypt
You are using pip version 10.0.1, however version 20.3b1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

解决方案1:

此方案由同事提供,我并未实践。

​ 1.安装版本更高的的Microsoft Visual C++版本,安装包见百度磁盘链接

​ 2.安装paramiko

​ 命令:pip install paramiko
解决方案2:

​ 1.安装pycrypto-2.6.1-cp36-cp36m-win_amd64.whl,安装包见百度磁盘链接

​ 命令: pip install pycrypto-2.6.1-cp36-cp36m-win_amd64.whl

​ 2.安装bcrypt==3.1.7

​ 命令:pip install bcrypt==3.1.7

3.安装paramiko==2.4.1

​ 命令:pip install paramiko==2.4.1

 下载

下载Microsoft Visual C++,pycrypto-2.6.1-cp36-cp36m-win_amd64.whl见下列百度磁盘地址:
https://pan.baidu.com/s/174lIOeNd9m1WNBqNrL62cQ 提取码:rbll
简单的文件上传代码:

 def load_file_to_service(local_path, remote_path):
"""
:param local_path: 本地路径,格式如: "d:\dd.txt"
:param remote_path: 远程路径
格式如:"/root/file/dd.txt"
"""
t = paramiko.Transport('192.111.103.153', 22)
//192.111.103.153:服务器地址 22:端口
t.connect(username='admin', password='123456')
//admin:服务器账号,123456:账号密码
sftp = paramiko.SFTPClient.from_transport(t)
sftp.put(local_path, remote_path)
# 上传文件到远程机
sftp.close()

最后

以上就是霸气月光为你收集整理的【记录】paramiko安装问题解决方案的全部内容,希望文章能够帮你解决【记录】paramiko安装问题解决方案所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(31)

评论列表共有 0 条评论

立即
投稿
返回
顶部