astral-sh发布的musl和gnu版本standalone python 性能比较
musl版本standalone python在wsl默认的ubuntu中无法运行。说是找不到文件其实文件就在那里C:\dwget https://mirror.nju.edu.cn/github-release/astral-sh/python-build-standalone/LatestRelease/cpython-3.14.5rc1%2B20260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz 2026-05-06 19:29:58 (40.0 MB/s) - cpython-3.14.5rc120260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz saved [28819140/28819140] C:\dwsl rootDESKTOP-59T6U68:/mnt/c/d# mkdir tpy3145 rootDESKTOP-59T6U68:/mnt/c/d# cd tpy3145 rootDESKTOP-59T6U68:/mnt/c/d/tpy3145# tar xf ../cpython-3.14.5rc120260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz rootDESKTOP-59T6U68:/mnt/c/d/tpy3145# cat /etc/issue Ubuntu 22.04.5 LTS \n \l rootDESKTOP-59T6U68:/mnt/c/d/tpy3145# time python/bin/python ../primes.py -bash: python/bin/python: No such file or directory real 0m0.018s user 0m0.001s sys 0m0.004s rootDESKTOP-59T6U68:/mnt/c/d/tpy3145# ls -l python/bin/ total 21464 lrwxrwxrwx 1 root root 8 Jan 1 2024 idle3 - idle3.14 -rwxrwxrwx 1 root root 156 Jan 1 2024 idle3.14 -rwxrwxrwx 1 root root 234 Jan 1 2024 pip -rwxrwxrwx 1 root root 234 Jan 1 2024 pip3 -rwxrwxrwx 1 root root 234 Jan 1 2024 pip3.14 lrwxrwxrwx 1 root root 9 Jan 1 2024 pydoc3 - pydoc3.14 -rwxrwxrwx 1 root root 141 Jan 1 2024 pydoc3.14 lrwxrwxrwx 1 root root 10 Jan 1 2024 python - python3.14 lrwxrwxrwx 1 root root 10 Jan 1 2024 python3 - python3.14 lrwxrwxrwx 1 root root 17 Jan 1 2024 python3-config - python3.14-config -rwxrwxrwx 1 root root 21971912 Jan 1 2024 python3.14 -rwxrwxrwx 1 root root 3198 Jan 1 2024 python3.14-config rootDESKTOP-59T6U68:/mnt/c/d/tpy3145# rm -fr python rootDESKTOP-59T6U68:/mnt/c/d/tpy3145# logout改用gnu版本standalone python一切正常。C:\dwget https://mirror.nju.edu.cn/github-release/astral-sh/python-build-standalone/LatestRelease/cpython-3.14.5rc1%2B20260504-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz 2026-05-06 19:36:13 (19.9 MB/s) - cpython-3.14.5rc120260504-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz saved [35924552/35924552] C:\dwsl rootDESKTOP-59T6U68:/mnt/c/d# cd tpy3145 rootDESKTOP-59T6U68:/mnt/c/d/tpy3145# tar xf ../cpython-3.14.5rc120260504-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz rootDESKTOP-59T6U68:/mnt/c/d/tpy3145# time python/bin/python ../primes.py real 0m1.982s user 0m1.623s sys 0m0.226s在网上查询得知Alpine版本Linux自带musl刚好机器上有个alpine docker容器。rootDESKTOP-59T6U68:/mnt/c/d/tpy3145# docker container list -a|grep Alpine rootDESKTOP-59T6U68:/mnt/c/d/tpy3145# docker container list -a|grep pine 9d3934fdf92d m.daocloud.io/docker.io/alpine:latest /bin/sh 16 months ago Exited (0) 16 months ago alp2 rootDESKTOP-59T6U68:/mnt/c/d/tpy3145# docker start alp2 alp2 rootDESKTOP-59T6U68:/mnt/c/d/tpy3145# docker exec -it alp2 bash Error: executable file bash not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found rootDESKTOP-59T6U68:/mnt/c/d/tpy3145# docker exec -it alp2 sh / # cd /par sh: cd: cant cd to /par: No such file or directory / # wget https://mirror.nju.edu.cn/github-release/astral-sh/python-build-standalone/LatestRelease/cpython-3.14.5rc1%2B20 260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz Connecting to mirror.nju.edu.cn (210.28.130.3:443) saving to cpython-3.14.5rc1%2B20260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz cpython-3.14.5rc1%2B 100% |************************************************************************| 27.4M 0:00:00 ETA cpython-3.14.5rc1%2B20260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz saved / # cd /tmp /tmp # tar xf ../cpython-3.14.5rc1%2B20260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz /tmp # vi /tmp # cat /etc/issue Welcome to Alpine Linux 3.21 Kernel \r on an \m (\l) /tmp # time python/bin/python primes.py real 0m 2.19s user 0m 1.97s sys 0m 0.22s果然musl版本standalone python可以在alpine中执行速度的确比版本号相同的gnu python版本要慢一些。
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2590685.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!