如何将git代理设置为与pip3一起运行?
按照https://github.com/nouiz/Theano-Docker的指示执行
当我运行docker build -t theano_simple -f Dockerfile.0.8.X.jupyter.cuda.simple .时,我会收到错误:
fatal: unable to connect to github.com:
github.com[0: 192.30.253.112]: errno=Connection timed out
github.com[1: 192.30.253.113]: errno=Connection timed out向docker文件中添加代理参数:
RUN git config --global http.proxy myproxy:1111
RUN git config --global https.proxy myproxy:1111环境病毒( ENV HTTPS_PROXY=https://myproxy:1111 ENV HTTPS_PROXY=https://myproxy:1111 ENV https_proxy=https://myproxy:1111 ENV https_proxy=https://myproxy:1111 )
下面是原始的停靠文件:https://github.com/nouiz/Theano-Docker/blob/master/Dockerfile.0.8.X.jupyter.cuda.simple
FROM nvidia/cuda:7.5-cudnn5-devel
MAINTAINER FIX ME <fixme@example.com>
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
libopenblas-dev \
libzmq3-dev \
python3-dev \
python3-numpy \
python3-pip \
python3-scipy && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install \
ipykernel \
jupyter && \
python3 -m ipykernel.kernelspec
RUN pip3 install nose nose-parameterized
ENV THEANO_VERSION 0.8.2
RUN pip3 install git+git://github.com/theano/theano.git@rel-${THEANO_VERSION}
COPY theanorc /root/.theanorc
COPY start-notebook.sh /usr/local/bin/
COPY jupyter_notebook_config_simple.py /root/.jupyter/jupyter_notebook_config.py
COPY notebook /opt/notebook
RUN apt-get update && apt-get install -y curl
RUN mkdir /opt/data && cd /opt/data && curl http://www.iro.umontreal.ca/~lisa/deep/data/mnist/mnist_py3k.pkl.gz -o mnist.pkl.gz使用代理命令修改的停靠文件:
FROM nvidia/cuda:7.5-cudnn5-devel
MAINTAINER FIX ME <fixme@example.com>
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
libopenblas-dev \
libzmq3-dev \
python3-dev \
python3-numpy \
python3-pip \
python3-scipy && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install \
ipykernel \
jupyter && \
python3 -m ipykernel.kernelspec
RUN pip3 install nose nose-parameterized
ENV THEANO_VERSION 0.8.2
ENV HTTPS_PROXY=https://myproxy:1111
ENV HTTPS_PROXY=https://myproxy:1111
ENV https_proxy=https://myproxy:1111
ENV https_proxy=https://myproxy:1111
RUN pip3 install git+git://github.com/theano/theano.git@rel-${THEANO_VERSION}
RUN git config --global http.proxy myproxy:1111
RUN git config --global https.proxy myproxy:1111
COPY theanorc /root/.theanorc
COPY start-notebook.sh /usr/local/bin/
COPY jupyter_notebook_config_simple.py /root/.jupyter/jupyter_notebook_config.py
COPY notebook /opt/notebook
RUN apt-get update && apt-get install -y curl
RUN mkdir /opt/data && cd /opt/data && curl http://www.iro.umontreal.ca/~lisa/deep/data/mnist/mnist_py3k.pkl.gz -o mnist.pkl.gz我还尝试将代理作为pip3 install:pip3 install --proxy myproxy:1111命令的一部分传递,但错误相同。
发布于 2017-01-05 17:10:23
fatal: unable to connect to github.com:
github.com[0: 192.30.253.112]: errno=Connection timed out
github.com[1: 192.30.253.113]: errno=Connection timed out错误消息似乎是由RUN pip3 install引起的,因此添加git代理并不适用于此。
您可以尝试在HTTPS_PROXY之前添加pip install env。
ENV HTTPS_PROXY=https://myproxy:1111发布于 2017-01-05 16:37:20
你试过以下几种方法吗?
pip3 install yourmodulename --trusted-host pypi.python.org发布于 2018-08-31 17:30:34
问题可能是您在公司代理/防火墙后面,并且传出的连接在某个地方被阻塞。一个简单的解决方案就是更改为命令的https版本:
更改:
pip3 install git+git://github.com/theano/theano.git@rel-${THEANO_VERSION}
至:
pip3 install git+https://github.com/theano/theano.git@rel-${THEANO_VERSION}
Alternatively:
您可能需要尝试以下步骤:https://help.github.com/articles/using-ssh-over-the-https-port/
这将通过大多数公司允许的https协议重定向所有git连接:)
祝好运!
https://stackoverflow.com/questions/41490010
复制相似问题