
Ich verwende ein Docker-Image tensorflow
von python3
:
FROM tensorflow/tensorflow:latest-gpu-py3
Ich brauche Cython
eine Bibliothek von Drittanbietern, also
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
Das Problem besteht darin, dass ich danach Cython
von sehen kann python
, aber nicht von 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
Antwort1
Ich habe festgestellt, dass die Lösung darin besteht, sowohl die Installation als auch die Ausführung pip3
der Bibliothek zu verwenden, also:Cython
python3
setup.py
RUN apt-get update && apt-get install -y \
python3-pip
Und
RUN \
pip3 install --no-cache-dir Cython
und die Bibliotheksebene
RUN \
cd lib && \
python3 setup.py
Die letzte Möglichkeit hätte eine pip3 install .
globale Installation mit sein können pip3
.
Dieses Mal
RUN python3 -c "import Cython; print(Cython.__version__)"
Ich hatte Cython
da:0.25.2