简体   繁体   English

无法在EC2上导入FTP_TLS

[英]Cannot import FTP_TLS on EC2

I'm writing an FTP script in python on EC2 where I need to be able to import FTP_TLS for the connection. 我正在EC2上用python写一个FTP脚本,我需要能够为该连接导入FTP_TLS。

from ftplib import FTP_TLS

Except, it gives me: 除了,它给了我:

ImportError: cannot import name FTP_TLS

I can import FTP_TLS on my local python shell, but it fails on EC2. 我可以在本地python shell上导入FTP_TLS,但在EC2上失败。

What's going on? 这是怎么回事?

EC2 Python 2.6.5 / Local Python 2.7.3 EC2 Python 2.6.5 /本地Python 2.7.3

FTP_TLS is only supported in Python 2.7+. 仅Python 2.7+支持FTP_TLS。

You could upgrade Python on your server, or just grab Lib/ftplib.py from source: 您可以在服务器上升级Python,也可以从源代码中获取Lib/ftplib.py

wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz

Put it in your load path and your import will work. 将其放在您的加载路径中, import就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 urllib.request.urlopen() 中使用 FTP_TLS(显式模式)(或等效于 FTP_TLS 的 `urlopen`) - How to use FTP_TLS (Explicit mode) with urllib.request.urlopen() (or equivalent of `urlopen` with FTP_TLS) Python3.6,ftp_tls和会话重用 - Python3.6, ftp_tls and session reuse Python:nlst()使用FTP_TLS挂在“清单上来了” - Python: nlst() hangs on “here come the listing” by using FTP_TLS Python FTPS (FTP_TLS) 连接被拒绝。 没有证书? - Python FTPS (FTP_TLS) connection refused. No certificate? Python 模块 ftplib FTP_TLS - 错误 530 - Python module ftplib FTP_TLS - Error 530 尝试使用Python FTP_TLS对象下载文件时获取AttributeError? - When trying to download files using a Python FTP_TLS object getting AttributeError? 当密码包含时,FTP_TLS 530 使用 Python3 登录不正确 § - FTP_TLS 530 Login Incorrect with Python3 when password contains § 尝试使用 FTP_TLS 从同一目录下载第二个文件时出现“ftplib.error_perm: 550 Operation not allowed” - "ftplib.error_perm: 550 Operation not permitted" when trying to download the second file from the same directory using FTP_TLS Ansible ec2.py 动态清单错误:ImportError: cannot import name 'ec2' - Ansible ec2.py dynamic inventory errors: ImportError: cannot import name 'ec2' 导入错误:无法从 AWS EC2 上的“psutil”导入名称“_psutil_linux” - ImportError: cannot import name '_psutil_linux' from 'psutil' on AWS EC2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM