gpt4 book ai didi

python - docker中的pipenv安装包失败

转载 作者:行者123 更新时间:2023-12-01 01:33:02 28 4
gpt4 key购买 nike

我有以下Pipfile:

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
mypy = "==0.521"

[requires]
python_version = "3.6"

以及Dockerfile:

FROM heroku/heroku:18

#Install system dependencies
RUN apt-get update && apt-get install -y software-properties-common build-essential curl nano

#Install python 3.6
RUN apt-get update
RUN apt-get install -y python3.6 libpython3.6 python3.6-dev python-dev python-pip \
python3-pip libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev

#Install backend packages
RUN pip3 install pipenv python-magic libmagic django
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

镜像构建并启动容器

docker build -t test -f Dockerfile .
docker run -it test /bin/bash

将 Pipfile 复制到容器

docker cp Pipfile <container>:/test/Pipfile

生成锁定文件

pipenv lock

尝试安装软件包

pipenv install --dev --system --python=`which python3`

错误

    An error occurred while installing mypy==0.521! Will try again.
An error occurred while installing typed-ast==1.0.4! Will try again.
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 2/2 — 00:00:01
Installing initially failed dependencies...
Collecting mypy==0.521 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/2 — 00:00:00
Using cached https://files.pythonhosted.org/packages/18/11/733e33decfdbd76cce7158c92618b9317d4132b41affd04db00216d17f76/mypy-0.521.tar.gz
Complete output from command python setup.py egg_info:
ERROR: You need Python 3.2 or later to use mypy.

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-cebwoI/mypy/

☤ ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/2 —

最佳答案

问题出在--system上。这使得 Pipenv 使用 pip 命令 - 该命令在 /usr/bin/pip 中解析,即 2.7 pip。
我发现如果您删除 --system 标志,它将正常运行。

root@5ce055e3cd89:~# pipenv install --dev --python 3
Virtualenv already exists!
Removing existing virtualenv...
Creating a virtualenv for this project...
Pipfile: /root/Pipfile
Using /usr/bin/python3 (3.6.6) to create virtualenv...
⠋Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /root/.local/share/virtualenvs/root-BuDEOXnJ/bin/python3
Also creating executable in /root/.local/share/virtualenvs/root-BuDEOXnJ/bin/python
Installing setuptools, pip, wheel...done.
Setting project for root-BuDEOXnJ to /root

Virtualenv location: /root/.local/share/virtualenvs/root-BuDEOXnJ
Installing dependencies from Pipfile.lock (0f51af)...
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 2/2 — 00:00:01
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

关于python - docker中的pipenv安装包失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52645125/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com