场景:内网服务器不能上外网(代理也不通!),
之前安装了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 s