1、requirements.txt中包含

paramiko==2.5.0

2、运行docker

 docker run -d 193.101.0.10:6666/zenap/rsync-python27-alpine:3.2 sleep 1d

docker ps|grep python

303ba8ea14c7

docker exec -it 303ba8ea14c7 sh

3、pip download

pip download -d ./1 paramiko==2.5.0

下载信息

Looking in indexes: https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/simple
Collecting paramiko==2.5.0
  Using cached https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/packages/packages/17/9f/7430d1ed509e195d5a5bb1a2bda6353a4aa64eb95491f198a17c44e2075c/paramiko-2.5.0-py2.py3-none-any.whl (198 kB)
  Saved ./1/paramiko-2.5.0-py2.py3-none-any.whl
Collecting bcrypt>=3.1.3
  Using cached https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/packages/packages/fa/aa/025a3ab62469b5167bc397837c9ffc486c42a97ef12ceaa6699d8f5a5416/bcrypt-3.1.7.tar.gz (42 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
  Saved ./1/bcrypt-3.1.7.tar.gz
Collecting pynacl>=1.0.1
  Using cached https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/packages/packages/cf/5a/25aeb636baeceab15c8e57e66b8aa930c011ec1c035f284170cacb05025e/PyNaCl-1.4.0.tar.gz (3.4 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
  Saved ./1/PyNaCl-1.4.0.tar.gz
Collecting cryptography>=2.5
  Using cached https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/packages/packages/b7/82/f7a4ddc1af185936c1e4fa000942ffa8fb2d98cff26b75afa7b3c63391c4/cryptography-3.3.1.tar.gz (539 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
  Saved ./1/cryptography-3.3.1.tar.gz
Collecting six>=1.4.1
  Using cached https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/packages/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl (10 kB)
  Saved ./1/six-1.15.0-py2.py3-none-any.whl
Collecting cffi>=1.1
  Using cached https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/packages/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz (471 kB)
  Saved ./1/cffi-1.14.4.tar.gz
Collecting enum34; python_version < "3"
  Using cached https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/packages/packages/6f/2c/a9386903ece2ea85e9807e0e062174dc26fdce8b05f216d00491be29fad5/enum34-1.1.10-py2-none-any.whl (11 kB)
  Saved ./1/enum34-1.1.10-py2-none-any.whl
Collecting ipaddress; python_version < "3"
  Using cached https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/packages/packages/c2/f8/49697181b1651d8347d24c095ce46c7346c37335ddc7d255833e7cde674d/ipaddress-1.0.23-py2.py3-none-any.whl (18 kB)
  Saved ./1/ipaddress-1.0.23-py2.py3-none-any.whl
Collecting pycparser
  Using cached https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/packages/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl (112 kB)
  Saved ./1/pycparser-2.20-py2.py3-none-any.whl
Successfully downloaded paramiko bcrypt pynacl cryptography six cffi enum34 ipaddress pycparser

下载成功

4、pip install

pip install --no-index --find-links=./1 paramiko==2.5.0

安装信息

Looking in links: ./1
Processing ./1/paramiko-2.5.0-py2.py3-none-any.whl
Processing ./1/bcrypt-3.1.7.tar.gz
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python /usr/lib/python2.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-hmmffv/overlay --no-warn-script-location --no-binary :none: --only-binary :none: --no-index --find-links ./1 --trusted-host artsz.zte.com.cn -- 'setuptools>=40.8.0' wheel 'cffi>=1.1; python_implementation != '"'"'PyPy'"'"''
       cwd: None
  Complete output (4 lines):
  DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
  Looking in links: ./1
  ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
  ERROR: No matching distribution found for setuptools>=40.8.0
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python /usr/lib/python2.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-hmmffv/overlay --no-warn-script-location --no-binary :none: --only-binary :none: --no-index --find-links ./1 --trusted-host artsz.zte.com.cn -- 'setuptools>=40.8.0' wheel 'cffi>=1.1; python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output.

在Processing ./1/bcrypt-3.1.7.tar.gz时失败是时因为building 时出错。

5、解决方法

使用apk list 查看已安装的包

https://cryptography.io/en/latest/installation.html

Alpine中安装

sudo apk add gcc musl-dev python-dev libffi-dev openssl-dev libressl-dev

If you get an error with openssl-dev you may have to use libressl-dev.

但还是报相同的错。

6、使用pip install paramiko==2.5.0安装

安装信息

Looking in indexes: https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/simple
Collecting paramiko==2.5.0
  Using cached https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/packages/packages/17/9f/7430d1ed509e195d5a5bb1a2bda6353a4aa64eb95491f198a17c44e2075c/paramiko-2.5.0-py2.py3-none-any.whl (198 kB)
Collecting bcrypt>=3.1.3
  Using cached https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/packages/packages/fa/aa/025a3ab62469b5167bc397837c9ffc486c42a97ef12ceaa6699d8f5a5416/bcrypt-3.1.7.tar.gz (42 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: pynacl>=1.0.1 in /usr/lib/python2.7/site-packages (from paramiko==2.5.0) (1.2.1)
Collecting cryptography>=2.5
  Using cached https://artsz.zte.com.cn/artifactory/api/pypi/public-pypi-virtual/packages/packages/b7/82/f7a4ddc1af185936c1e4fa000942ffa8fb2d98cff26b75afa7b3c63391c4/cryptography-3.3.1.tar.gz (539 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: six>=1.4.1 in /usr/lib/python2.7/site-packages (from bcrypt>=3.1.3->paramiko==2.5.0) (1.12.0)
Requirement already satisfied: cffi>=1.1 in /usr/lib/python2.7/site-packages (from bcrypt>=3.1.3->paramiko==2.5.0) (1.10.0)
Requirement already satisfied: enum34; python_version < "3" in /usr/lib/python2.7/site-packages (from cryptography>=2.5->paramiko==2.5.0) (1.1.6)
Requirement already satisfied: ipaddress; python_version < "3" in /usr/lib/python2.7/site-packages (from cryptography>=2.5->paramiko==2.5.0) (1.0.22)
Requirement already satisfied: pycparser in /usr/lib/python2.7/site-packages (from cffi>=1.1->bcrypt>=3.1.3->paramiko==2.5.0) (2.18)
Building wheels for collected packages: bcrypt, cryptography
  Building wheel for bcrypt (PEP 517) ... done
  Created wheel for bcrypt: filename=bcrypt-3.1.7-cp27-cp27mu-linux_x86_64.whl size=60131 sha256=baba209ae2f10017e145e625243eb06691d2cc783f181f584caddbe7af611d76
  Stored in directory: /root/.cache/pip/wheels/25/2d/eb/8256891bb644d0bc36ea32717c062723b07401459364e10926
  Building wheel for cryptography (PEP 517) ... done
  Created wheel for cryptography: filename=cryptography-3.3.1-cp27-cp27mu-linux_x86_64.whl size=776322 sha256=d76a86467fec6d0a25c2a79758397280bcbe63c5b3d35f6d1831aa7578372057
  Stored in directory: /root/.cache/pip/wheels/b4/a5/db/1dba11ee07786dd4de71338239bb8af023f83a34445928d172
Successfully built bcrypt cryptography
Installing collected packages: bcrypt, cryptography, paramiko
  Attempting uninstall: cryptography
    Found existing installation: cryptography 2.1.4
    Uninstalling cryptography-2.1.4:
      Successfully uninstalled cryptography-2.1.4
ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.

We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.

cryptography 3.3.1 requires cffi>=1.12, but you'll have cffi 1.10.0 which is incompatible.
Successfully installed bcrypt-3.1.7 cryptography-3.3.1 paramiko-2.5.0

在building时,将gz包,building为wheel文件,

Building wheels for collected packages: bcrypt, cryptography
  Building wheel for bcrypt (PEP 517) ... done
  Created wheel for bcrypt: filename=bcrypt-3.1.7-cp27-cp27mu-linux_x86_64.whl size=60131 sha256=baba209ae2f10017e145e625243eb06691d2cc783f181f584caddbe7af611d76
  Stored in directory: /root/.cache/pip/wheels/25/2d/eb/8256891bb644d0bc36ea32717c062723b07401459364e10926
  Building wheel for cryptography (PEP 517) ... done
  Created wheel for cryptography: filename=cryptography-3.3.1-cp27-cp27mu-linux_x86_64.whl size=776322 sha256=d76a86467fec6d0a25c2a79758397280bcbe63c5b3d35f6d1831aa7578372057
  Stored in directory: /root/.cache/pip/wheels/b4/a5/db/1dba11ee07786dd4de71338239bb8af023f83a34445928d172
Successfully built bcrypt cryptography

filename=cryptography-3.3.1-cp27-cp27mu-linux_x86_64.wh放在 /root/.cache/pip/wheels/b4/a5/db/1dba11ee07786dd4de71338239bb8af023f83a34445928d172此处,所以,可以将这里生成的文件复制到packages中,便能使用这个文件pip install

~ # mv /root/.cache/pip/wheels/b4/a5/db/1dba11ee07786dd4de71338239bb8af023f83a34445928d1
72/cryptography-3.3.1-cp27-cp27mu-linux_x86_64.whl ./1
~ # ls
1
~ # cd 1
~/1 # ls
PyNaCl-1.4.0.tar.gz
bcrypt-3.1.7.tar.gz
cffi-1.14.4.tar.gz
cryptography-3.3.1-cp27-cp27mu-linux_x86_64.whl
cryptography-3.3.1.tar.gz
enum34-1.1.10-py2-none-any.whl
ipaddress-1.0.23-py2.py3-none-any.whl
paramiko-2.5.0-py2.py3-none-any.whl
pycparser-2.20-py2.py3-none-any.whl
six-1.15.0-py2.py3-none-any.whl

删除cryptography-3.3.1.tar.gz包

使用pip install --no-index --find-links=. paramiko==2.5.0安装成功。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐