Linux下python包放在哪,在alpinlinux中使用apk安装的Python包
发布日期:2021-10-31 15:52:36 浏览次数:4 分类:技术文章

本文共 2153 字,大约阅读时间需要 7 分钟。

我想用apk在Alpine Linux中安装一些Python包。我用numpy作为下面的例子。

文档文件FROM python:3-alpine

RUN apk add --update py3-numpy

我建立我的码头形象$ docker build -t python-numpy .

Sending build context to Docker daemon 2.048kB

Step 1/2 : FROM python:3-alpine

---> 930a7e894675

Step 2/2 : RUN apk add --update py3-numpy

---> Running in b30470090cde

fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz

fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz

(1/6) Installing libgcc (8.3.0-r0)

(2/6) Installing libquadmath (8.3.0-r0)

(3/6) Installing libgfortran (8.3.0-r0)

(4/6) Installing openblas (0.3.6-r0)

(5/6) Installing python3 (3.7.3-r0)

(6/6) Installing py3-numpy (1.16.4-r1)

Executing busybox-1.30.1-r2.trigger

OK: 113 MiB in 41 packages

Removing intermediate container b30470090cde

---> 5a82ffa67522

Successfully built 5a82ffa67522

Successfully tagged python-numpy:latest

运行它并尝试用python导入包$ docker run -it --rm python-numpy python -c "import numpy"

Traceback (most recent call last):

File "", line 1, in

ModuleNotFoundError: No module named 'numpy'

但是,没有找到。在apk add --update py3-numpy之后运行pip install numpy不考虑apk包py3-numpy并下载另一个版本:Collecting numpy

Downloading https://files.pythonhosted.org/packages/da/32/1b8f2bb5fb50e4db68543eb85ce37b9fa6660cd05b58bddfafafa7ed62da/numpy-1.17.0.zip (6.5MB)

...

如果我指定的版本与pip install numpy==1.16.4-r1中的py3-numpy(参见docker build的输出)相同,则会导致Collecting numpy==1.16.4-r1

ERROR: Could not find a version that satisfies the requirement numpy==1.16.4-r1 (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0b3, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.11.1rc1, 1.11.1, 1.11.2rc1, 1.11.2, 1.11.3, 1.12.0b1, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.12.1rc1, 1.12.1, 1.13.0rc1, 1.13.0rc2, 1.13.0, 1.13.1, 1.13.3, 1.14.0rc1, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0rc1, 1.15.0rc2, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0rc1, 1.16.0rc2, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.17.0rc1, 1.17.0rc2, 1.17.0)

ERROR: No matching distribution found for numpy==1.16.4-r1

我错过了什么?

转载地址:https://blog.csdn.net/weixin_39987847/article/details/116951866 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:c语言系统时间的作用,C语言得到当前系统时间
下一篇:linux系统怎么安装pr,Linux安装后的配置

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年03月29日 19时14分18秒