我试图在我的系统上安装Pysftp库(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。(pip install pysftp)和Python3。我的python3版本是3.5,所以我不知道如何修复这个
不知怎么的,你有一个Python 3.6+的setuptools版本,导致解释器在f字符串上卡住(这是在3.6中添加的)。重新安装你的发行版的setuptools -我相信命令是sudo apt install python-setuptools
-然后重新运行pip3 install pysftp
。