
Estoy usando una imagen de Docker tensorflow
con python3
:
FROM tensorflow/tensorflow:latest-gpu-py3
Necesito Cython
que haya una biblioteca de terceros allí, así que lo hago
RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \
rm get-pip.py
RUN \
pip install --no-cache-dir Cython
El problema es que después de eso puedo ver Cython
desde python
, pero no desde python3
:
root@fdb5bb783cf9:/darkflow# python3 -c "import Cython; print(Cython.__version__)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'Cython'
root@fdb5bb783cf9:/darkflow# python -c "import Cython; print(Cython.__version__)"
0.25.2
Respuesta1
Descubrí que la solución era usarla pip3
para ejecutar Cython
la instalación y también python3
para ejecutar setup.py
la biblioteca, así que:
RUN apt-get update && apt-get install -y \
python3-pip
y
RUN \
pip3 install --no-cache-dir Cython
y la capa de biblioteca
RUN \
cd lib && \
python3 setup.py
El último podría haber sido pip3 install .
instalar globalmente usando pip3
.
esta vez haciendo
RUN python3 -c "import Cython; print(Cython.__version__)"
Tuve Cython
allí:0.25.2