通过离线安装包解决了 from cryptography.hazmat.bindings._openssl import ffi, lib ImportError: /usr/local/python36/lib/python3.6/site-packages/cryptography-2.2.2-py3.6-linux-x86_64.egg/cryptography/hazmat/binding
场景:内网服务器不能上外网(代理也不通!),
之前安装了PYTHON的几个安装包,但不是知道为什么无法使用PARAMIKO这个模块
在导入 from cryptography.hazmat.bindings._openssl import ffi, lib 的时候会
报错:
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /usr/local/python36/lib/python3.6/site-packages/cryptography-2.2.2-py3.6-linux-x86_64.egg/cryptography/hazmat/bindings/_openssl.abi3.so: undefined symbol: d2i_DHxparams
找了好多资料都没有解决,没办法只好放弃原有的安装方式,之前是一个个手动下载模块,传到内网服务器后 通过PYTHON SETUP.PY INSTALL 安装。
现在打算在外网通过PIP 下载模块,再打包到内网服务器,然后利用pip安装,这样可以避免模块之间依赖的问题
注:以下步骤是安装单个包的,下例子以安装paramiko包(较多依赖)说明
步骤说明:
1、使用pip download 命令下载wheel文件至下载目录~/pippackage目录下
pip install paramiko --download ~/pippackage/
或者
[root@master pippackage]# pip download paramiko --src ./
[djuser@localhost ~]$ mkvirtualenv py3test
New python executable in /home/djuser/.virtualenvs/py3test/bin/python2
Also creating executable in /home/djuser/.virtualenvs/py3test/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /home/djuser/.virtualenvs/py3test/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/djuser/.virtualenvs/py3test/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/djuser/.virtualenvs/py3test/bin/preactivate
virtualenvwrapper.user_scripts creating /home/djuser/.virtualenvs/py3test/bin/postactivate
virtualenvwrapper.user_scripts creating /home/djuser/.virtualenvs/py3test/bin/get_env_details
(py3test) [djuser@localhost ~]$ lssitepackages
easy_install.py pip pkg_resources setuptools-40.0.0.dist-info wheel-0.31.1.dist-info
easy_install.pyc pip-10.0.1.dist-info setuptools wheel
(py3test) [djuser@localhost ~]$ mkdir pippackage
(py3test) [djuser@localhost ~]$ pip installl paramiko --download ~/pippackage/
ERROR: unknown command "installl" - maybe you meant "install"
(py3test) [djuser@localhost ~]$ pip install paramiko --download ~/pippackage/
Usage:
pip install [options] <requirement specifier> [package-index-options] ...
pip install [options] -r <requirements file> [package-index-options] ...
pip install [options] [-e] <vcs project url> ...
pip install [options] [-e] <local project path> ...
pip install [options] <archive url/path> ...
no such option: --download
(py3test) [djuser@localhost ~]$ pip3 install paramiko --download ~/pippackage/
DEPRECATION: pip install --download has been deprecated and will be removed in the future. Pip now has a download command that should be used instead.
Collecting paramiko
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/3e/db/cb7b6656e0e7387637ce850689084dc0b94b44df31cc52e5fc5c2c4fd2c1/paramiko-2.4.1-py2.py3-none-any.whl (194kB)
100% |████████████████████████████████| 194kB 107kB/s
Saved ./pippackage/paramiko-2.4.1-py2.py3-none-any.whl
Collecting cryptography>=1.5 (from paramiko)
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/fa/f4/3cde3604972dfa2b0fea85b9711948bb4fb70ab64095322aef35071bd254/cryptography-2.2.2-cp34-abi3-manylinux1_x86_64.whl (2.2MB)
100% |████████████████████████████████| 2.2MB 117kB/s
Saved ./pippackage/cryptography-2.2.2-cp34-abi3-manylinux1_x86_64.whl
Collecting pynacl>=1.0.1 (from paramiko)
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/77/03/927e4cdbd821f929392608ddb2220a9548ce164c52047e90fadd20786fd8/PyNaCl-1.2.1-cp36-cp36m-manylinux1_x86_64.whl (692kB)
100% |████████████████████████████████| 696kB 269kB/s
Saved ./pippackage/PyNaCl-1.2.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting pyasn1>=0.1.7 (from paramiko)
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/a0/70/2c27740f08e477499ce19eefe05dbcae6f19fdc49e9e82ce4768be0643b9/pyasn1-0.4.3-py2.py3-none-any.whl (72kB)
100% |████████████████████████████████| 81kB 761kB/s
Saved ./pippackage/pyasn1-0.4.3-py2.py3-none-any.whl
Collecting bcrypt>=3.1.3 (from paramiko)
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/b8/09/905ec939994e2c49dcffff72f823802557f166b3815ea54c1db3671eed42/bcrypt-3.1.4-cp36-cp36m-manylinux1_x86_64.whl (54kB)
100% |████████████████████████████████| 61kB 418kB/s
Saved ./pippackage/bcrypt-3.1.4-cp36-cp36m-manylinux1_x86_64.whl
Collecting idna>=2.1 (from cryptography>=1.5->paramiko)
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
100% |████████████████████████████████| 61kB 467kB/s
Saved ./pippackage/idna-2.7-py2.py3-none-any.whl
Collecting six>=1.4.1 (from cryptography>=1.5->paramiko)
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Saved ./pippackage/six-1.11.0-py2.py3-none-any.whl
Collecting cffi>=1.7; platform_python_implementation != "PyPy" (from cryptography>=1.5->paramiko)
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/6d/c0/47db8f624f3e4e2f3f27be03a93379d1ba16a1450a7b1aacfa0366e2c0dd/cffi-1.11.5-cp36-cp36m-manylinux1_x86_64.whl (421kB)
100% |████████████████████████████████| 430kB 516kB/s
Saved ./pippackage/cffi-1.11.5-cp36-cp36m-manylinux1_x86_64.whl
Collecting asn1crypto>=0.21.0 (from cryptography>=1.5->paramiko)
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl (101kB)
100% |████████████████████████████████| 102kB 394kB/s
Saved ./pippackage/asn1crypto-0.24.0-py2.py3-none-any.whl
Collecting pycparser (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography>=1.5->paramiko)
Cache entry deserialization failed, entry ignored
Saved ./pippackage/pycparser-2.18-py2.py3-none-any.whl
Successfully downloaded paramiko cryptography pynacl pyasn1 bcrypt idna six cffi asn1crypto pycparser
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(py3test) [djuser@localhost ~]$ cd pippackage/
(py3test) [djuser@localhost pippackage]$ ll
总用量 3892
-rw-rw-r--. 1 djuser djuser 101571 7月 13 15:04 asn1crypto-0.24.0-py2.py3-none-any.whl
-rw-rw-r--. 1 djuser djuser 54260 7月 13 15:04 bcrypt-3.1.4-cp36-cp36m-manylinux1_x86_64.whl
-rw-rw-r--. 1 djuser djuser 421443 7月 13 15:04 cffi-1.11.5-cp36-cp36m-manylinux1_x86_64.whl
-rw-rw-r--. 1 djuser djuser 2152496 7月 13 15:04 cryptography-2.2.2-cp34-abi3-manylinux1_x86_64.whl
-rw-rw-r--. 1 djuser djuser 58213 7月 13 15:04 idna-2.7-py2.py3-none-any.whl
-rw-rw-r--. 1 djuser djuser 194536 7月 13 15:04 paramiko-2.4.1-py2.py3-none-any.whl
-rw-rw-r--. 1 djuser djuser 72560 7月 13 15:04 pyasn1-0.4.3-py2.py3-none-any.whl
-rw-rw-r--. 1 djuser djuser 205978 7月 13 15:04 pycparser-2.18-py2.py3-none-any.whl
-rw-rw-r--. 1 djuser djuser 692905 7月 13 15:04 PyNaCl-1.2.1-cp36-cp36m-manylinux1_x86_64.whl
-rw-rw-r--. 1 djuser djuser 10702 7月 13 15:04 six-1.11.0-py2.py3-none-any.whl
(py3test) [djuser@localhost ~]$ tar -cvf pippack.tar pippackage/
打包后 传到服务器上
解压后执行
pip install paramiko-2.4.1-py2.py3-none-any.whl --no-index --find-links=~/pippackage/
安装完成 PARAMIKO 模块就可以正常使用 也没有再报错
原博主有加 --user 参数,但是我加了之后不能执行,不知道为什么,暂时不考虑了。
通过离线安装包解决了 from cryptography.hazmat.bindings._openssl import ffi, lib ImportError: /usr/local/python36/lib/python3.6/site-packages/cryptography-2.2.2-py3.6-linux-x86_64.egg/cryptography/hazmat/binding的更多相关文章
- 下载Google浏览器(Google Chrome)离线安装包方法
Chrome浏览器默认是在线安装的,但由于网络的原因,有时很久也不能完成安装.其实Chrome官方是提供离线安装包的.具体地址如下: 稳定版:http://www.google.com/chrome/ ...
- 如何更新 Visual Studio 2017 的离线安装包
现在 Visual Studio 2017 已经不再使用原来的 iso 镜像提供离线安装包了,需要的话,可以通过命令行参数下载离线安装包,例如: vs_Enterprise.exe --layout ...
- 如何创建 Visual Studio 2017 RC 离线安装包
创建 Visual Studio 的离线安装计划 首先下载相应版本的可执行文件,例如:vs_community.exe.vs_enterprise.exe 或 vs_professional 在 cm ...
- Windows 7集成IE11(离线安装包、补丁)
当Win7系统需要集成IE11时,我们需要提前打入6个补丁 KB2731771.KB2786081.KB2834140.KB2670838.KB2729094.KB2533623 32位 ★百度网盘 ...
- vs2017 rc 离线安装包制作
vs2017 rc 离线安装包制作 1.下载在线安装包:https://aka.ms/vs/15/release/vs_Enterprise.exe 2.制作离线安装包: vs_Enterprise. ...
- Chrome Restful Api 测试工具 Postman-REST-Client离线安装包下载,Axure RP Extension for Chrome离线版下载
[Postman for Chrome 离线下载] Postman-REST-Client离线安装包,可直接在Chrome浏览器本地安装使用,可模拟各种http请求,Restful Api测试, CS ...
- Ubuntu离线安装包制作(转载)
From:http://blog.csdn.net/nupt123456789/article/details/11649603 1.应用场景 a.需要在多台电脑上安装同一软件,且软件很大,下载需要时 ...
- 省去在线安装 直接下载Chrome官方离线安装包
首页>软件之家>便捷上网 省去在线安装 直接下载Chrome官方离线安装包 2013-10-12 23:22:02来源:IT之家 原创作者:阿象责编:阿象人气:54487 评论:19 谷歌 ...
- 制作Visual Studio 2017 (VS 2017) 离线安装包
史上功能最强大的Visual Studio 2017版本发布,但是由于版本更新速度加快和与第三方工具包集成的原因,微软研发团队没有为这个版本提供离线下载的安装文件.如果用户处在一个与外网隔离的网络环境 ...
随机推荐
- centos搭建lamp环境参考(根据腾讯云实验室)
1.安装MYSQL 使用 yum 安装 MySQL: yum install mysql-server -y 安装完成后,启动 MySQL 服务: service mysqld restart 设置 ...
- Comet OJ - Contest #6 C 一道树题 数学 + 推导
Code: #include <bits/stdc++.h> #define setIO(s) freopen(s".in","r",stdin) ...
- 把图片画到画布上,适应PC和移动端
画一张图片到画布上 <canvas id="myCanvas" width="1000px" height="200px" >您 ...
- Web 与 Node 基础
浏览器端发送请求(browser) 浏览器或者模拟发送 http 请求端 服务端处理请求(web) 服务器(使用 node ) 2.1. 使用 Forever 管理程序 2.2. 可以使用 PM2 代 ...
- Qt 中文问题
Qt windows/linux跨平台中文编码解决 系统环境:windows8.1 / ubuntu 14.04Qt5.4.2 QtCreator 3.4.1 编码设置:QtCreator:工具/选项 ...
- IntelliJ常用配置备忘
前言 最近IntelliJ又由于自己的骚操作给弄崩溃了,导致之前弄的一大波配置又找不到了,十分蛋疼的又要开始重头开始弄环境.很多之前精心搞过的配置又都记不住了,为了防止以后出现这种情况,这里就把我日常 ...
- 架构-数据库访问-SQL语言进行连接数据库服务器-DB-Library:DB-Library
ylbtech-数据库访问-SQL语言进行连接数据库服务器-DB-Library:DB-Library 1.返回顶部 1. 在基于三层构架的信息系统开发中,应用服务器要利用SQL语言进行连接数据库服务 ...
- 005-unity3d 添加背景音乐、音效 以及 天空盒子
一.基础知识 1.项目中需要有AudioListener,播放器中播放的声音就是AudioListener组件坐在的位置听到的声音.默认AudioListener是放到Main Camera上.没有A ...
- 测开之路九十二:css之背景色和背景
引用css 设置背景色: 背景图片 整个页面的背景图片 图片当局部背景图 也可以简写 css /* css基本样式 */ /* 设置p标签的文字前景色.背景色 */p{ /*字体颜色为蓝色*/ col ...
- C 语言跟 C++ 的差异比较
C++ 完整的 CHM 版离线手册,可以 从这里下载. C++头文件不必是 .h 结尾 C语言中的标准库头文件,例如 math.h 和 stdio.h,在C++中被命名为 cmath 和 cstdio ...