为什么80%的码农都做不了架构师?>>>
根据paramiko官网的指示,可以使用pip安装paramiko模块默认安装最新的稳定版本的paramiko
使用pip安装paramiko
sudo pip3 install paramiko
出现一堆错误信息:
liuxin@sunshine-virtual-machine:~/work/python/python/socket/socketserver/ftp_client$ sudo pip3 install paramiko
[sudo] password for liuxin:
对不起,请重试。
[sudo] password for liuxin:
对不起,请重试。
[sudo] password for liuxin:
Downloading/unpacking paramikoDownloading paramiko-2.4.0-py2.py3-none-any.whl (192kB): 192kB downloaded
Downloading/unpacking bcrypt>=3.1.3 (from paramiko)Downloading bcrypt-3.1.4.tar.gz (42kB): 42kB downloadedRunning setup.py (path:/tmp/pip_build_root/bcrypt/setup.py) egg_info for package bcryptwarning: no previously-included files found matching 'requirements.txt'warning: no previously-included files found matching 'tasks.py'warning: no previously-included files found matching '.travis.yml'warning: no previously-included files found matching 'wheel-scripts'warning: no previously-included files found matching 'Jenkinsfile'warning: no previously-included files found matching '.jenkins'warning: no previously-included files matching '*' found under directory '.jenkins'warning: no previously-included files matching '*' found under directory 'wheel-scripts'no previously-included directories found matching '.travis'
Downloading/unpacking pynacl>=1.0.1 (from paramiko)Downloading PyNaCl-1.2.1.tar.gz (3.3MB): 3.3MB downloadedRunning setup.py (path:/tmp/pip_build_root/pynacl/setup.py) egg_info for package pynaclPackage libffi was not found in the pkg-config search path.Perhaps you should add the directory containing `libffi.pc'to the PKG_CONFIG_PATH environment variableNo package 'libffi' foundPackage libffi was not found in the pkg-config search path.Perhaps you should add the directory containing `libffi.pc'to the PKG_CONFIG_PATH environment variableNo package 'libffi' foundPackage libffi was not found in the pkg-config search path.Perhaps you should add the directory containing `libffi.pc'to the PKG_CONFIG_PATH environment variableNo package 'libffi' foundPackage libffi was not found in the pkg-config search path.Perhaps you should add the directory containing `libffi.pc'to the PKG_CONFIG_PATH environment variableNo package 'libffi' foundPackage libffi was not found in the pkg-config search path.Perhaps you should add the directory containing `libffi.pc'to the PKG_CONFIG_PATH environment variableNo package 'libffi' foundc/_cffi_backend.c:15:17: fatal error: ffi.h: 没有那个文件或目录#include ^compilation terminated.Traceback (most recent call last):File "/usr/lib/python3.4/distutils/unixccompiler.py", line 116, in _compileextra_postargs)File "/usr/lib/python3.4/distutils/ccompiler.py", line 909, in spawnspawn(cmd, dry_run=self.dry_run)File "/usr/lib/python3.4/distutils/spawn.py", line 36, in spawn_spawn_posix(cmd, search_path, dry_run=dry_run)File "/usr/lib/python3.4/distutils/spawn.py", line 162, in _spawn_posix% (cmd, exit_status))distutils.errors.DistutilsExecError: command 'i686-linux-gnu-gcc' failed with exit status 1During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/usr/lib/python3.4/distutils/core.py", line 148, in setupdist.run_commands()File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commandsself.run_command(cmd)File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_commandcmd_obj.run()File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 185, in runcmd = self.call_command('install_lib', warn_dir=0)File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 171, in call_commandself.run_command(cmdname)File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_commandself.distribution.run_command(command)File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_commandcmd_obj.run()File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 21, in runself.build()File "/usr/lib/python3.4/distutils/command/install_lib.py", line 109, in buildself.run_command('build_ext')File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_commandself.distribution.run_command(command)File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_commandcmd_obj.run()File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 49, in run_build_ext.run(self)File "/usr/lib/python3.4/distutils/command/build_ext.py", line 339, in runself.build_extensions()File "/usr/lib/python3.4/distutils/command/build_ext.py", line 448, in build_extensionsself.build_extension(ext)File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 178, in build_extension_build_ext.build_extension(self,ext)File "/usr/lib/python3.4/distutils/command/build_ext.py", line 503, in build_extensiondepends=ext.depends)File "/usr/lib/python3.4/distutils/ccompiler.py", line 574, in compileself._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)File "/usr/lib/python3.4/distutils/unixccompiler.py", line 118, in _compileraise CompileError(msg)distutils.errors.CompileError: command 'i686-linux-gnu-gcc' failed with exit status 1During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1025, in run_setuprun_setup(setup_script, args)File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 50, in run_setuplambda: execfile(File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 100, in runreturn func()File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 52, in {'__file__':setup_script, '__name__':'__main__'}File "/usr/lib/python3/dist-packages/setuptools/compat.py", line 78, in execfileexec(compile(source, fn, 'exec'), globs, locs)File "setup.py", line 236, in cmdclass={File "/usr/lib/python3.4/distutils/core.py", line 163, in setupraise SystemExit("error: " + str(msg))SystemExit: error: command 'i686-linux-gnu-gcc' failed with exit status 1During handling of the above exception, another exception occurred:Traceback (most recent call last):File "", line 17, in File "/tmp/pip_build_root/pynacl/setup.py", line 251, in "Programming Language :: Python :: 3.6",File "/usr/lib/python3.4/distutils/core.py", line 108, in setup_setup_distribution = dist = klass(attrs)File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 239, in __init__self.fetch_build_eggs(attrs.pop('setup_requires'))File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 264, in fetch_build_eggsreplace_conflicting=TrueFile "/usr/lib/python3/dist-packages/pkg_resources.py", line 620, in resolvedist = best[req.key] = env.best_match(req, ws, installer)File "/usr/lib/python3/dist-packages/pkg_resources.py", line 858, in best_matchreturn self.obtain(req, installer) # try and download/installFile "/usr/lib/python3/dist-packages/pkg_resources.py", line 870, in obtainreturn installer(requirement)File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 314, in fetch_build_eggreturn cmd.easy_install(req)File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 616, in easy_installreturn self.install_item(spec, dist.location, tmpdir, deps)File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 646, in install_itemdists = self.install_eggs(spec, download, tmpdir)File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 834, in install_eggsreturn self.build_and_install(setup_script, setup_base)File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1040, in build_and_installself.run_setup(setup_script, setup_base, args)File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1028, in run_setupraise DistutilsError("Setup script exited with %s" % (v.args[0],))distutils.errors.DistutilsError: Setup script exited with error: command 'i686-linux-gnu-gcc' failed with exit status 1Complete output from command python setup.py egg_info:Package libffi was not found in the pkg-config search path.Perhaps you should add the directory containing `libffi.pc'to the PKG_CONFIG_PATH environment variableNo package 'libffi' foundPackage libffi was not found in the pkg-config search path.Perhaps you should add the directory containing `libffi.pc'to the PKG_CONFIG_PATH environment variableNo package 'libffi' foundPackage libffi was not found in the pkg-config search path.Perhaps you should add the directory containing `libffi.pc'to the PKG_CONFIG_PATH environment variableNo package 'libffi' foundPackage libffi was not found in the pkg-config search path.Perhaps you should add the directory containing `libffi.pc'to the PKG_CONFIG_PATH environment variableNo package 'libffi' foundPackage libffi was not found in the pkg-config search path.Perhaps you should add the directory containing `libffi.pc'to the PKG_CONFIG_PATH environment variableNo package 'libffi' foundc/_cffi_backend.c:15:17: fatal error: ffi.h: 没有那个文件或目录#include ^compilation terminated.Traceback (most recent call last):File "/usr/lib/python3.4/distutils/unixccompiler.py", line 116, in _compileextra_postargs)File "/usr/lib/python3.4/distutils/ccompiler.py", line 909, in spawnspawn(cmd, dry_run=self.dry_run)File "/usr/lib/python3.4/distutils/spawn.py", line 36, in spawn_spawn_posix(cmd, search_path, dry_run=dry_run)File "/usr/lib/python3.4/distutils/spawn.py", line 162, in _spawn_posix% (cmd, exit_status))distutils.errors.DistutilsExecError: command 'i686-linux-gnu-gcc' failed with exit status 1During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/usr/lib/python3.4/distutils/core.py", line 148, in setupdist.run_commands()File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commandsself.run_command(cmd)File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_commandcmd_obj.run()File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 185, in runcmd = self.call_command('install_lib', warn_dir=0)File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 171, in call_commandself.run_command(cmdname)File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_commandself.distribution.run_command(command)File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_commandcmd_obj.run()File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 21, in runself.build()File "/usr/lib/python3.4/distutils/command/install_lib.py", line 109, in buildself.run_command('build_ext')File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_commandself.distribution.run_command(command)File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_commandcmd_obj.run()File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 49, in run_build_ext.run(self)File "/usr/lib/python3.4/distutils/command/build_ext.py", line 339, in runself.build_extensions()File "/usr/lib/python3.4/distutils/command/build_ext.py", line 448, in build_extensionsself.build_extension(ext)File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 178, in build_extension_build_ext.build_extension(self,ext)File "/usr/lib/python3.4/distutils/command/build_ext.py", line 503, in build_extensiondepends=ext.depends)File "/usr/lib/python3.4/distutils/ccompiler.py", line 574, in compileself._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)File "/usr/lib/python3.4/distutils/unixccompiler.py", line 118, in _compileraise CompileError(msg)distutils.errors.CompileError: command 'i686-linux-gnu-gcc' failed with exit status 1During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1025, in run_setuprun_setup(setup_script, args)File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 50, in run_setuplambda: execfile(File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 100, in runreturn func()File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 52, in {'__file__':setup_script, '__name__':'__main__'}File "/usr/lib/python3/dist-packages/setuptools/compat.py", line 78, in execfileexec(compile(source, fn, 'exec'), globs, locs)File "setup.py", line 236, in cmdclass={File "/usr/lib/python3.4/distutils/core.py", line 163, in setupraise SystemExit("error: " + str(msg))SystemExit: error: command 'i686-linux-gnu-gcc' failed with exit status 1During handling of the above exception, another exception occurred:Traceback (most recent call last):File "", line 17, in File "/tmp/pip_build_root/pynacl/setup.py", line 251, in "Programming Language :: Python :: 3.6",File "/usr/lib/python3.4/distutils/core.py", line 108, in setup_setup_distribution = dist = klass(attrs)File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 239, in __init__self.fetch_build_eggs(attrs.pop('setup_requires'))File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 264, in fetch_build_eggsreplace_conflicting=TrueFile "/usr/lib/python3/dist-packages/pkg_resources.py", line 620, in resolvedist = best[req.key] = env.best_match(req, ws, installer)File "/usr/lib/python3/dist-packages/pkg_resources.py", line 858, in best_matchreturn self.obtain(req, installer) # try and download/installFile "/usr/lib/python3/dist-packages/pkg_resources.py", line 870, in obtainreturn installer(requirement)File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 314, in fetch_build_eggreturn cmd.easy_install(req)File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 616, in easy_installreturn self.install_item(spec, dist.location, tmpdir, deps)File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 646, in install_itemdists = self.install_eggs(spec, download, tmpdir)File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 834, in install_eggsreturn self.build_and_install(setup_script, setup_base)File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1040, in build_and_installself.run_setup(setup_script, setup_base, args)File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1028, in run_setupraise DistutilsError("Setup script exited with %s" % (v.args[0],))distutils.errors.DistutilsError: Setup script exited with error: command 'i686-linux-gnu-gcc' failed with exit status 1----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/pynacl
Storing debug log for failure in /home/liuxin/.pip/pip.log
查看错误日志时发现一条信息:
No package 'libffi' found
所以使用下面安装libffi:
sudo apt-get install libffi-dev
再次使用pip3安装paramiko模块又提示如下错误:
error in cryptography setup command: Invalid environment marker: python_version <&#39;3&#39;
别灰心&#xff0c;出现别的错误说明有进展
上网搜了一下这个错误找到一个解决方案&#xff1a;https://github.com/ansible/ansible/issues/31741
看到没&#xff1f;它也在安装libffi&#xff0c;至少说明我们的方向没有错&#xff0c; 按照大神的提示执行一下指令&#xff1a;
sudo pip3 install --upgrade setuptools
sudo apt-get install libffi-dev libssl-dev
再次安装paramiko
sudo pip3 install paramiko
安装成功&#xff0c;打开python3解释器测试模块&#xff1a;
Successfully installed paramiko pyasn1 bcrypt cryptography pynacl cffi idna asn1crypto pycparser
Cleaning up...
liuxin&#64;sunshine-virtual-machine:~/work/python/python/socket/socketserver/ftp_client$ python3
Python 3.4.3 (default, Nov 28 2017, 16:40:41)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
>>>
ok&#xff0c; 搞定
总结&#xff1a;
在使用pip3安装paramiko模块执行以下指令&#xff1a;
sudo pip3 install --upgrade setuptools
sudo apt-get install libffi-dev libssl-dev
sudo pip3 install paramiko