windows下很多庫安裝不方便,主要是編譯C之類的。
之前這樣做:
1去https://www.lfd.uci.edu/~gohlke/pythonlibs/ 下載各種版本編譯好的.whl
2 pip install XXX.whl 。
但是用pipenv就報各種hash256錯誤
比如
Installing dependencies from Pipfile.lock (f6c5bf)▒▒
An error occurred while installing D:/soft/dev/gis/Fiona-1.7.13-cp37-cp37m-win_amd64.whl --hash=sha256:08e2d84b2f96103ec905765ccbdbc5a497c0d419168121c354e6f90b9d7e144b --hash=sha256:17737637827391c96cad9d0b76372ebba5d1cc5d6ef15bb85e931d92dd053f44 --hash=sha256:35e28e27ea9af9e7e5dcb0f00488fb584fef55065de8d6b92aaace5bdd07e865 --hash=sha256:6342e5ebd24c6dcd8c5ba114796c874fe14b3828f16dc47624158b1f159043eb --hash=sha256:6629d151a64d960ca44832ab9d148ee47a2107a122a21ece74d52ed464f07d71 --hash=sha256:82dd9bc2eaf841b7cc84904c36f86daa32a3303f40f09a66c736d7dbab3e43fd --hash=sha256:a156129f0904cb7eb24aa0745b6075da54f2c31db168ed3bcac8a4bd716d77b2 --hash=sha256:b405fb2cfebb641fba419563fb39530c6d81910c1efdc75f685a24faa8c415e8 --hash=sha256:b74e617379ea4365e56ce041c4fb421bf588688222ba7e657192402a49eb29ba --hash=sha256:e77bddaea50c2145136a863afeb8f9f4d799dd2523f2f0db1e40e739355e343d --hash=sha256:e8854f3d66436f21eb1eb18ffe51c1ed47c931f859118073b22592347f48faa5 --hash=sha256:eecc67f0b1b492979e525f6d9f4f2ef6284beb5f506164cf4b202050a50d748d! Will try again.
去官網,發現這個bug 1年前就討論半天了,也沒見解決:
Cannot install from a local wheel #914
去stackoverflow上看到這樣:https://stackoverflow.com/questions/51528441/pipenv-how-to-handle-locally-installed-whl-packages
1打開https://www.lfd.uci.edu/~gohlke/pythonlibs/
2chrome瀏覽器按F12 開啟控制台,點擊要下載的文件,控制台上顯示文件網址
3復制這個地址,用pipenv安裝形如
pipenv install https://download.lfd.uci.edu/pythonlibs/l8ulg3xw/aiohttp-3.3.2-cp36-cp36m-win_amd64.whl
但這么干仍然有錯誤,最新官網作者回復,似乎不太重要
THESE PACKAGES DO NOT MATCH THE HASHES FROM Pipfile.lock #2863
Given that the wheel is from PyTorch it very well might be that they simply changed the wheel and now the hash is different. This is completely outside of our control and exactly what pipenv is designed to catch. If you don't mind, just re-lock with
pipenv lock
.