我对python很陌生,想开始在python中使用pysftp模块。但是,当在下面找到说明时
here https://www.pythonforbeginners.com/modules-in-python/python-secure-ftp-module
我相信由于超时而无法解决问题,但是我不知道如何理解。
C:\Users\userno1>cd c:\Users\userno1\AppData\Local\Conda\Scripts
c:\Users\userno1\AppData\Local\Conda\Scripts>pip search pysftp
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connecti
on broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connect
ion.VerifiedHTTPSConnection object at 0x00000000048EE358>, 'Connection to pypi.p
ython.org timed out. (connect timeout=15)')': /pypi
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connecti
on broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connect
ion.VerifiedHTTPSConnection object at 0x00000000048FC9E8>, 'Connection to pypi.p
ython.org timed out. (connect timeout=15)')': /pypi
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connecti
on broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connect
ion.VerifiedHTTPSConnection object at 0x00000000048FCA58>, 'Connection to pypi.p
ython.org timed out. (connect timeout=15)')': /pypi
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connecti
on broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connect
ion.VerifiedHTTPSConnection object at 0x00000000048FCBA8>, 'Connection to pypi.p
ython.org timed out. (connect timeout=15)')': /pypi
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connecti
on broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connect
ion.VerifiedHTTPSConnection object at 0x00000000048FCCF8>, 'Connection to pypi.p
ython.org timed out. (connect timeout=15)')': /pypi
Exception:
Traceback (most recent call last):
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\connection.py", line 142, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\util\connection.py", line 91, in create_connection
raise err
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\util\connection.py", line 81, in create_connection
sock.connect(sa)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\connectionpool.py", line 578, in urlopen
chunked=chunked)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\connectionpool.py", line 351, in _make_request
self._validate_conn(conn)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\connectionpool.py", line 814, in _validate_conn
conn.connect()
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\connection.py", line 254, in connect
conn = self._new_conn()
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\connection.py", line 147, in _new_conn
(self.host, self.timeout))
pip._vendor.requests.packages.urllib3.exceptions.ConnectTimeoutError: (<pip._ven
dor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000
00000048FCE48>, 'Connection to pypi.python.org timed out. (connect timeout=15)')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\adapters.py", line 403, in send
timeout=timeout
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\connectionpool.py", line 651, in urlopen
release_conn=release_conn, **response_kw)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\connectionpool.py", line 651, in urlopen
release_conn=release_conn, **response_kw)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\connectionpool.py", line 651, in urlopen
release_conn=release_conn, **response_kw)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\connectionpool.py", line 651, in urlopen
release_conn=release_conn, **response_kw)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\connectionpool.py", line 651, in urlopen
release_conn=release_conn, **response_kw)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\connectionpool.py", line 623, in urlopen
_stacktrace=sys.exc_info()[2])
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\packages\urllib3\util\retry.py", line 281, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
pip._vendor.requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionP
ool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi (Cau
sed by ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.Ver
ifiedHTTPSConnection object at 0x00000000048FCE48>, 'Connection to pypi.python.o
rg timed out. (connect timeout=15)'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\basecomman
d.py", line 215, in main
status = self.run(options, args)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\commands\s
earch.py", line 43, in run
pypi_hits = self.search(query, options)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\commands\s
earch.py", line 60, in search
hits = pypi.search({'name': query, 'summary': query}, 'or')
File "c:\Users\userno1\AppData\Local\Conda\lib\xmlrpc\client.py", line 1092
, in __call__
return self.__send(self.__name, args)
File "c:\Users\userno1\AppData\Local\Conda\lib\xmlrpc\client.py", line 1432
, in __request
verbose=self.__verbose
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\download.p
y", line 764, in request
headers=headers, stream=True)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\sessions.py", line 518, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\download.p
y", line 378, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\sessions.py", line 585, in send
r = adapter.send(request, **kwargs)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\ca
checontrol\adapter.py", line 46, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "c:\Users\userno1\AppData\Local\Conda\lib\site-packages\pip\_vendor\re
quests\adapters.py", line 459, in send
raise ConnectTimeout(e, request=request)
pip._vendor.requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='pypi.p
ython.org', port=443): Max retries exceeded with url: /pypi (Caused by ConnectTi
meoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnec
tion object at 0x00000000048FCE48>, 'Connection to pypi.python.org timed out. (c
onnect timeout=15)'))
答案 0 :(得分:1)
经过大量的反复试验,我列出了行得通和不行的内容:
什么有效?
conda install pysftp
什么不起作用?
pip install pysftp
python -m pip install pysftp
答案 1 :(得分:0)
我在使用 conda 安装 pysftp 时遇到问题,因为没有可用的 linux-armv7l 包。
我通过以下方式解决了:
apt-get install paramiko
pip install pysftp
pip 包与 paramiko 有一些依赖关系。 也许它也适用于不同的架构