Skip to content

Instantly share code, notes, and snippets.

@shcallaway
Last active December 14, 2018 22:00
Show Gist options
  • Save shcallaway/6e1a055fb70338fdf216dcb8d7bc1822 to your computer and use it in GitHub Desktop.
Save shcallaway/6e1a055fb70338fdf216dcb8d7bc1822 to your computer and use it in GitHub Desktop.
Fix "Python ImportError: No module named '_curses'"
# Will throw an error if Python was configured without libncursesw5-dev
import curses
FROM ubuntu
RUN apt-get update && apt-get install --assume-yes make wget gcc zlib1g:amd64 zlib1g-dev:amd64
# Uncomment the following line to make 'import curses' work
# RUN apt-get update && apt-get install -y libncursesw5-dev
ENV PYTHON_VERSION 3.6.1
RUN wget --quiet https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz && \
tar xzvf Python-$PYTHON_VERSION.tgz && \
cd Python-$PYTHON_VERSION && \
./configure && \
make install
ADD /curses.py /curses.py
CMD python3 curses.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment