我曾尝试安装 Pysftp lib(https://pypi.org/project/pysftp/) 但是每当我尝试在 Python2.x 或 Python3.x 中安装它时,它都会出现错误。
在Python2.X中错误
Collecting pynacl>=1.0.1 (from paramiko>=1.17->pysftp==0.2.9->-r requirements.txt (line 1))
Using cached https://files.pythonhosted.org/packages/a7/22/27582568be639dfe22ddb3902225f91f2f17ceff88ce80e4db396c8986da/PyNaCl-1.5.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-_k6VkE/pynacl/setup.py", line 29, in <module>
from setuptools.command.build_clib import build_clib as _build_clib
ImportError: No module named build_clib
在Python3.X中错误
Collecting pysftp
Using cached https://files.pythonhosted.org/packages/36/60/45f30390a38b1f92e0a8cf4de178cd7c2bc3f874c85430e40ccf99df8fe7/pysftp-0.2.9.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/ubuntu/.local/lib/python3.5/site-packages/setuptools/__init__.py", line 8, in <module>
import _distutils_hack.override # noqa: F401
File "/home/ubuntu/.local/lib/python3.5/site-packages/_distutils_hack/override.py", line 1, in <module>
__import__('_distutils_hack').do_override()
File "/home/ubuntu/.local/lib/python3.5/site-packages/_distutils_hack/__init__.py", line 72, in do_override
ensure_local_distutils()
File "/home/ubuntu/.local/lib/python3.5/site-packages/_distutils_hack/__init__.py", line 58, in ensure_local_distutils
core = importlib.import_module('distutils.core')
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/ubuntu/.local/lib/python3.5/site-packages/setuptools/_distutils/core.py", line 17, in <module>
from distutils.dist import Distribution
File "/home/ubuntu/.local/lib/python3.5/site-packages/setuptools/_distutils/dist.py", line 19, in <module>
from distutils.util import check_environ, strtobool, rfc822_escape
File "/home/ubuntu/.local/lib/python3.5/site-packages/setuptools/_distutils/util.py", line 171
raise DistutilsPlatformError(f"nothing known about platform '{os.name}'")
^
SyntaxError: invalid syntax
我使用的 cmd 是 Python2.X (pip install pysftp) 和 Python3.X (pip3 install pysftp),而我的 python3 版本是 3.5,所以我不知道如何解决这个问题