為什么你需要升級(jí) pip ?
[itamarst@blake dev]$ docker run -it ubuntu:18.04
root@1a43d55f0524:/# apt-get update
...
root@1a43d55f0524:/# apt-get install --no-install-recommends python3 python3-pip
...
root@1a43d55f0524:/# pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
root@1a43d55f0524:/# pip3 install cryptography
Collecting cryptography
Downloading https://files.pythonhosted.org/packages/fa/2d/2154d8cb773064570f48ec0b60258a4522490fcb115a6c7c9423482ca993/cryptography-3.4.6.tar.gz (546kB)
100% |################################| 552kB 1.4MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-6jesygn0/cryptography/
setuptools,編譯器和Python開發(fā)工具鏈,這將起作用,但非常慢。package。PyArrow也會(huì)發(fā)生相同的問題,例如:root@1a43d55f0524:/# pip3 install pyarrow
Collecting pyarrow
Downloading https://files.pythonhosted.org/packages/62/d3/a482d8a4039bf931ed6388308f0cc0541d0cab46f0bbff7c897a74f1c576/pyarrow-3.0.0.tar.gz (682kB)
100% |################################| 686kB 1.1MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-heq6zwd7/pyarrow/
Fil,Python內(nèi)存分析器https://pythonspeed.com/products/filmemoryprofiler/。root@1a43d55f0524:/# pip3 install filprofiler
Collecting filprofiler
Downloading https://files.pythonhosted.org/packages/e3/a2/843e7b5f1aba27effb0146c7e564e2592bfc9344a8c8ef0d55245bd47508/filprofiler-0.7.2-cp36-cp36m-manylinux1_x86_64.whl (565kB)
100% |################################| 573kB 1.8MB/s
Installing collected packages: filprofiler
Successfully installed filprofiler-0.7.2
Fil的PyPI頁(yè)面(https://pypi.org/project/filprofiler/)外,您都會(huì)看到``0.7.2`的版本很舊。在撰寫本文時(shí),F(xiàn)il的最新版本是0.14.1。pip和manylinux輪子NumPy到Cryptography的許多軟件包都要求在C / C ++ / Cython / Rust / etc中編譯一些代碼。為了節(jié)省您從頭開始編譯所有內(nèi)容的需要,維護(hù)人員可以將代碼的編譯版本(“ wheels”)上載到Python Package Index。如果pip碰到適用于您的特定版本的Python和操作系統(tǒng)版本的輪子,它將下載它而不是源代碼。manylinux1,manylinux2010和manylinux2014。您可以在下載的輪子的文件名中看到正在使用哪個(gè)變體。manylinux2010,當(dāng)然也不支持manylinux2014。Ubuntu 18.04中的pip太舊了,因此它只了解manylinux1。這解釋了我們看到的兩個(gè)問題:PyArrow 3.0.0的可用文件列表(https://pypi.org/project/pyarrow/3.0.0/#files),您會(huì)看到只有很多linux2010和linux2014的輪子。因此,pip會(huì)回退到需要編譯的源代碼包。Fil的PyPI文件(https://pypi.org/project/filprofiler/0.14.1/#files),則會(huì)看到有manylinux2010輪子,而根本沒有源程序包;因?yàn)閺脑创a構(gòu)建有點(diǎn)棘手,所以我只分發(fā)編譯后的程序包。這意味著pip會(huì)繼續(xù)使用該軟件包的較早版本,直到找到具有manylinux1輪子的軟件包為止。pip install --upgrade pip來每天進(jìn)行一次升級(jí)。pip install來修改系統(tǒng)軟件包。$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python3 get-pip.py
pip install --upgrade pip升級(jí)其pip:root@1a43d55f0524:/# python3 -m venv myvenv
root@1a43d55f0524:/# . myvenv/bin/activate
(myvenv) root@1a43d55f0524:/# pip --version
pip 9.0.1 from /myvenv/lib/python3.6/site-packages (python 3.6)
(myvenv) root@1a43d55f0524:/# pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Successfully installed pip-21.0.1
pip,我們可以輕松地安裝最新版本的cryptography和filprofiler:(myvenv) root@1a43d55f0524:/# pip install cryptography filprofiler
Collecting cryptography
Downloading cryptography-3.4.6-cp36-abi3-manylinux2014_x86_64.whl (3.2 MB)
|################################| 3.2 MB 4.5 MB/s
...
Installing collected packages: pycparser, threadpoolctl, cffi, filprofiler, cryptography
Successfully installed cffi-1.14.5 cryptography-3.4.6 filprofiler-0.14.1 pycparser-2.20 threadpoolctl-2.1.0
cryptography的manylinux2014軟件包。glibc)。您可以使用ldd實(shí)用工具查看可執(zhí)行文件或共享庫(kù)鏈接到哪些庫(kù):root@1a43d55f0524:/# cd myenv/lib/python3.6/site-packages
root@1a43d55f0524:/# ldd cryptography/hazmat/bindings/_openssl.abi3.so
linux-vdso.so.1 (0x00007ffdbea7b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fba7b1bf000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fba7adce000)
/lib64/ld-linux-x86-64.so.2 (0x00007fba7b7b0000)
/lib/x86_64-linux-gnu/libc.so.6,即glibc。glibc的較新版本編譯代碼,它可能不需要在舊版本提供新的API或符號(hào)。這意味著你的代碼不會(huì)在舊的Linux發(fā)行版上運(yùn)行。Conda通過針對(duì)舊版本的glibc頭文件來編譯所有的包;基本上在廣泛的Linux發(fā)行版它有一個(gè)自定義編譯安裝設(shè)計(jì)工作。glibc來解決這個(gè)問題。因?yàn)樗轻槍?duì)舊版本編譯的,它會(huì)與任何新版本兼容工作。manylinux1包建在CentOS 5。manylinux2010包建在CentOS 6。manylinux2014軟件包都建立在CentOS 7上。
PEP-571和PEP-599。Dockerfile,請(qǐng)確保升級(jí)pip。否則,你就會(huì)有一個(gè)更難的時(shí)間安裝軟件包。更多閱讀
特別推薦

點(diǎn)擊下方閱讀原文加入社區(qū)會(huì)員
評(píng)論
圖片
表情
