
Estou usando uma imagem Docker tensorflow
com python3
:
FROM tensorflow/tensorflow:latest-gpu-py3
Eu preciso Cython
que uma biblioteca de terceiros esteja lá, então eu preciso
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
O problema é que depois disso posso ver Cython
from python
, mas não from 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
Responder1
Descobri que a solução era usar pip3
para executar Cython
a instalação e também python3
para executar setup.py
a biblioteca, então:
RUN apt-get update && apt-get install -y \
python3-pip
e
RUN \
pip3 install --no-cache-dir Cython
e a camada da biblioteca
RUN \
cd lib && \
python3 setup.py
O último poderia ter sido pip3 install .
instalar globalmente usando pip3
.
Dessa vez fazendo
RUN python3 -c "import Cython; print(Cython.__version__)"
Eu tinha Cython
lá:0.25.2