热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

运行Docker镜像时出错.没有显示名为cv2,request,boto3的模块

如何解决《运行Docker镜像时出错.没有显示名为cv2,request,boto3的模块》经验,为你挑选了1个好方法。

你可以运行你的容器:

docker run -it 

并在python控制台中执行以下命令,该命令将在容器中安装指定的包:

import os
os.system("pip install --upgrade pip")
os.system("pip install numpy requests boto3 opencv-python")

你会看见:

Collecting numpy
  Downloading numpy-1.13.3-cp36-cp36m-manylinux1_x86_64.whl (17.0MB)
    100% |????????????????????????????????| 17.0MB 124kB/s 
Collecting requests
  Downloading requests-2.18.4-py2.py3-none-any.whl (88kB)
    100% |????????????????????????????????| 92kB 4.8MB/s 
Collecting boto3
  Downloading boto3-1.4.7-py2.py3-none-any.whl (128kB)
    100% |????????????????????????????????| 133kB 3.4MB/s 
Collecting opencv-python
  Downloading opencv_python-3.3.0.10-cp36-cp36m-manylinux1_x86_64.whl (15.4MB)
    100% |????????????????????????????????| 15.5MB 126kB/s 
Collecting certifi>=2017.4.17 (from requests)
  Downloading certifi-2017.11.5-py2.py3-none-any.whl (330kB)
    100% |????????????????????????????????| 337kB 2.9MB/s 
Collecting chardet<3.1.0,>=3.0.2 (from requests)
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB)
    100% |????????????????????????????????| 143kB 4.4MB/s 
Collecting idna<2.7,>=2.5 (from requests)
  Downloading idna-2.6-py2.py3-none-any.whl (56kB)
    100% |????????????????????????????????| 61kB 6.0MB/s 
Collecting urllib3<1.23,>=1.21.1 (from requests)
  Downloading urllib3-1.22-py2.py3-none-any.whl (132kB)
    100% |????????????????????????????????| 133kB 3.4MB/s 
Collecting jmespath<1.0.0,>=0.7.1 (from boto3)
  Downloading jmespath-0.9.3-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.10 (from boto3)
  Downloading s3transfer-0.1.11-py2.py3-none-any.whl (54kB)
    100% |????????????????????????????????| 61kB 6.4MB/s 
Collecting botocore<1.8.0,>=1.7.0 (from boto3)
  Downloading botocore-1.7.46-py2.py3-none-any.whl (3.7MB)
    100% |????????????????????????????????| 3.7MB 535kB/s 
Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.8.0,>=1.7.0->boto3)
  Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
    100% |????????????????????????????????| 194kB 3.1MB/s 
Collecting docutils>=0.10 (from botocore<1.8.0,>=1.7.0->boto3)
  Downloading docutils-0.14-py3-none-any.whl (543kB)
    100% |????????????????????????????????| 552kB 2.2MB/s 
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore<1.8.0,>=1.7.0->boto3)
  Downloading six-1.11.0-py2.py3-none-any.whl
Installing collected packages: numpy, certifi, chardet, idna, urllib3, requests, jmespath, six, python-dateutil, docutils, botocore, s3transfer, boto3, opencv-python
Successfully installed boto3-1.4.7 botocore-1.7.46 certifi-2017.11.5 chardet-3.0.4 docutils-0.14 idna-2.6 jmespath-0.9.3 numpy-1.13.3 opencv-python-3.3.0.10 python-dateutil-2.6.1 requests-2.18.4 s3transfer-0.1.11 six-1.11.0 urllib3-1.22

一切都好.我在使用FROM python:latestDockerfile 构建的容器中测试了它.



1> Artsiom Pran..:

你可以运行你的容器:

docker run -it 

并在python控制台中执行以下命令,该命令将在容器中安装指定的包:

import os
os.system("pip install --upgrade pip")
os.system("pip install numpy requests boto3 opencv-python")

你会看见:

Collecting numpy
  Downloading numpy-1.13.3-cp36-cp36m-manylinux1_x86_64.whl (17.0MB)
    100% |????????????????????????????????| 17.0MB 124kB/s 
Collecting requests
  Downloading requests-2.18.4-py2.py3-none-any.whl (88kB)
    100% |????????????????????????????????| 92kB 4.8MB/s 
Collecting boto3
  Downloading boto3-1.4.7-py2.py3-none-any.whl (128kB)
    100% |????????????????????????????????| 133kB 3.4MB/s 
Collecting opencv-python
  Downloading opencv_python-3.3.0.10-cp36-cp36m-manylinux1_x86_64.whl (15.4MB)
    100% |????????????????????????????????| 15.5MB 126kB/s 
Collecting certifi>=2017.4.17 (from requests)
  Downloading certifi-2017.11.5-py2.py3-none-any.whl (330kB)
    100% |????????????????????????????????| 337kB 2.9MB/s 
Collecting chardet<3.1.0,>=3.0.2 (from requests)
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB)
    100% |????????????????????????????????| 143kB 4.4MB/s 
Collecting idna<2.7,>=2.5 (from requests)
  Downloading idna-2.6-py2.py3-none-any.whl (56kB)
    100% |????????????????????????????????| 61kB 6.0MB/s 
Collecting urllib3<1.23,>=1.21.1 (from requests)
  Downloading urllib3-1.22-py2.py3-none-any.whl (132kB)
    100% |????????????????????????????????| 133kB 3.4MB/s 
Collecting jmespath<1.0.0,>=0.7.1 (from boto3)
  Downloading jmespath-0.9.3-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.10 (from boto3)
  Downloading s3transfer-0.1.11-py2.py3-none-any.whl (54kB)
    100% |????????????????????????????????| 61kB 6.4MB/s 
Collecting botocore<1.8.0,>=1.7.0 (from boto3)
  Downloading botocore-1.7.46-py2.py3-none-any.whl (3.7MB)
    100% |????????????????????????????????| 3.7MB 535kB/s 
Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.8.0,>=1.7.0->boto3)
  Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
    100% |????????????????????????????????| 194kB 3.1MB/s 
Collecting docutils>=0.10 (from botocore<1.8.0,>=1.7.0->boto3)
  Downloading docutils-0.14-py3-none-any.whl (543kB)
    100% |????????????????????????????????| 552kB 2.2MB/s 
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore<1.8.0,>=1.7.0->boto3)
  Downloading six-1.11.0-py2.py3-none-any.whl
Installing collected packages: numpy, certifi, chardet, idna, urllib3, requests, jmespath, six, python-dateutil, docutils, botocore, s3transfer, boto3, opencv-python
Successfully installed boto3-1.4.7 botocore-1.7.46 certifi-2017.11.5 chardet-3.0.4 docutils-0.14 idna-2.6 jmespath-0.9.3 numpy-1.13.3 opencv-python-3.3.0.10 python-dateutil-2.6.1 requests-2.18.4 s3transfer-0.1.11 six-1.11.0 urllib3-1.22

一切都好.我在使用FROM python:latestDockerfile 构建的容器中测试了它.


推荐阅读
author-avatar
NE丰胸茶urghx
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有