Installing and Using Python Modules in a Docker Container

喜夏-厌秋 提交于 2021-01-29 07:01:23

问题


I am new to using docker containers. I have successfully created a new docker container but am now having trouble installing and then using python modules in it.

I entered into the already running container with the following command:

$docker exec -it lizzie /bin/bash

This worked. I also managed to install the module of interest to me with the following command:

$pip install pysnmp

I cloned my git repository, entered the local repo, and attempted to run a script that utilized the module pysnmp. The following error was returned:

ImportError: No module named pysnmp

I reinstalled the module to ensure that it had installed correctly; all requirements were already satisfied. The two folders currently in the docker are a folder called "anaconda-ks.cfg" which I can't enter and the repo. I feel like this has something to do with the path the module was installed in but I'm not sure where I should be installing it or how to do so. Thanks in advance for the help!

来源:https://stackoverflow.com/questions/55148655/installing-and-using-python-modules-in-a-docker-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!