场景:内网服务器不能上外网(代理也不通!),
之前安装了PYTHON的几个安装包,但不是知道为什么无法使用PARAMIKO这个模块
报错:
找了好多资料都没有解决,没办法只好放弃原有的安装方式,之前是一个个手动下载模块,传到内网服务器后 通过PYTHON SETUP.PY INSTALL 安装。
现在打算在外网通过PIP 下载模块,再打包到内网服务器,然后利用pip安装,这样可以避免模块之间依赖的问题
注:以下步骤是安装单个包的,下例子以安装paramiko包(较多依赖)说明
步骤说明:
1、使用pip download 命令下载wheel文件至下载目录~/pippackage目录下
或者
[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
(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/
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
Collecting cryptography>=1.5 (from paramiko)
Collecting pynacl>=1.0.1 (from paramiko)
Collecting pyasn1>=0.1.7 (from paramiko)
Collecting bcrypt>=3.1.3 (from paramiko)
Collecting idna>=2.1 (from cryptography>=1.5->paramiko)
Collecting six>=1.4.1 (from cryptography>=1.5->paramiko)
Collecting cffi>=1.7; platform_python_implementation != "PyPy" (from cryptography>=1.5->paramiko)
Collecting asn1crypto>=0.21.0 (from cryptography>=1.5->paramiko)
Collecting pycparser (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography>=1.5->paramiko)
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
(py3test) [djuser@localhost ~]$ tar -cvf pippack.tar pippackage/
打包后 传到服务器上
解压后执行
原博主有加 --user 参数,但是我加了之后不能执行,不知道为什么,暂时不考虑了。
原文:https://www.cnblogs.com/s-seven/p/9306461.html