【问题标题】:Python 3.5 SFTP file transferPython 3.5 SFTP 文件传输
【发布时间】:2015-12-16 17:29:09
【问题描述】:

我想在 Python 3.5 中使用 paramiko 进行 SFTP 文件传输。我知道 paramiko 依赖于 PyCrypto 并且已经阅读了 Python 3.5 中的 PyCrypto 安装问题。尽管我看到了很多关于这个主题的问题,但我还没有找到在 Python 3.5 中成功进行 SFTP 文件传输的解决方案。

我的第一个问题:是否可以使用 Python 3.5 进行 SFTP 文件传输?如果是这样,paramiko 会起作用吗?如果上述方法可行,为什么我在尝试安装 PyCrypto 时收到以下错误?

error: [WinError 2] The system canot find the file specified
**Failed building wheel for pycrypto**


我的第二个问题:如果 paramiko 不能与 Python 3.5 一起使用,是否有任何替代方案或者我必须恢复到以前的 python 版本来进行 SFTP 文件传输?

【问题讨论】:

标签: python sftp paramiko pycrypto


【解决方案1】:

解决方案是在我的 Linux 服务器上安装 Python 3.5.1,然后从那里安装 pip install paramiko。我仍然不确定为什么 PyCrypto 不能安装在 Windows 的 Python 3.5 中,但这是我能找到的唯一解决方案。

【讨论】:

    【解决方案2】:

    如果您没有安装 C++ 编译器(需要使用该 pip 编译此库),您可以为 Python 3.5 安装 PyCrypto 二进制文件

    从此站点安装 PyCrypto 二进制文件: https://github.com/sfbahr/PyCrypto-Wheels

    最好的方法是:

    64 位 Python

    c:\Python35\Scripts\pip.exe install --use-wheel --no-index --find-links=https://github.com/sfbahr/PyCrypto-Wheels/raw/master/pycrypto-2.6.1-cp35-none-win_amd64.whlpycrypto

    32 位 Python

    c:\Python35\Scripts\pip.exe install --use-wheel --no-index --find-links=https://github.com/sfbahr/PyCrypto-Wheels/raw/master/pycrypto-2.6.1-cp35-none-win32.whlpycrypto

    当然用你的 python pip 路径替换 c:\Python35\Scripts\pip.exe

    要了解您的 python 版本,请运行 python 并查看括号中显示的架构:

    C:\Users\utilisateur>python

    Python 3.5.1 |Anaconda 4.0.0(64 位)| (默认,2016 年 2 月 16 日,09:49:46)[MSC v.1900 64 bit (AMD64)] 在 win32 上 输入“help”、“copyright”、“credits”或“license”了解更多信息。

    希望这能有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-02
      • 1970-01-01
      • 1970-01-01
      • 2020-01-25
      相关资源
      最近更新 更多