Contents ...
udn網路城邦
get package for pip install in local 下載pip軟體包用於離線安裝
2021/05/05 13:37
瀏覽350
迴響0
推薦0
引用0
munpy, opencv-python, anaconda
下載pip軟體包,用於離線安裝
三不五時要clean build,重灌u16,重建canda env,連線太麻煩了.
下載whl/gz後,之後只要用sh檔一次重灌就好了.

how to get whl package for pip install in local ?

how to pip install without net?

//----
Frist, in conda envirenment, pip install a kit, like opencv-python
You will see:

pip install opencv-python
Collecting opencv-python
Downloading opencv_python-4.5.1.48-cp38-cp38-manylinux2014_x86_64.whl (50.4 MB)
|████████████████████████████████| 50.4 MB 2.5 MB/s
Collecting numpy>=1.17.3
Downloading numpy-1.20.2-cp38-cp38-manylinux2010_x86_64.whl (15.4 MB)
|████████████████████████████████| 15.4 MB 1.8 MB/s
Installing collected packages: numpy, opencv-python
Successfully installed numpy-1.20.2 opencv-python-4.5.1.48


save the message as :
log_pip_install.log

//---
how to download opencv_python-4.5.1.48-cp38-cp38-manylinux2014_x86_64.whl manually ?

pip download opencv-python

Collecting opencv-python
Using cached opencv_python-4.5.1.48-cp38-cp38-manylinux2014_x86_64.whl (50.4 MB)
Collecting numpy>=1.17.3
Using cached numpy-1.20.2-cp38-cp38-manylinux2010_x86_64.whl (15.4 MB)
Saved ./opencv_python-4.5.1.48-cp38-cp38-manylinux2014_x86_64.whl
Saved ./numpy-1.20.2-cp38-cp38-manylinux2010_x86_64.whl
Successfully downloaded opencv-python numpy

system will auto find and download the file of opencv_python-4.5.1.48-cp38-cp38-manylinux2014_x86_64.whl

//----
how to keep all whl/gz of tensorflow ?

Frist, in conda envirenment, pip install tensorflow, and copy/past the log to file. Using grep/awk to extract information

# grep "Collecting" log_pip_install.log | awk { print $2 } > list_pkgname
#
# grep "Downloading" log_pip_install.log | awk { print $2 } > list_downloadname

file of list_pkgname for pip download

wrapt~=1.12.1
grpcio~=1.32.0
keras-preprocessing~=1.1.2
google-pasta~=0.2
tensorflow-estimator<2.5.0,>=2.4.0
tensorboard~=2.4
h5py~=2.10.0
numpy~=1.19.2
protobuf>=3.9.2
typing-extensions~=3.7.4
opt-einsum~=3.3.0
absl-py~=0.10
astunparse~=1.6.3
termcolor~=1.1.0
six~=1.15.0
flatbuffers~=1.12.0
gast==0.3.3
markdown>=2.6.8
google-auth<2,>=1.6.3
tensorboard-data-server<0.7.0,>=0.6.0
tensorboard-plugin-wit>=1.6.0
google-auth-oauthlib<0.5,>=0.4.1
requests<3,>=2.21.0
werkzeug>=0.11.15
rsa<5,>=3.1.4
cachetools<5.0,>=2.0.0
pyasn1-modules>=0.2.1
requests-oauthlib>=0.7.0
pyasn1<0.5.0,>=0.4.6
urllib3<1.27,>=1.21.1
chardet<5,>=3.0.2
idna<3,>=2.5
oauthlib>=3.0.0

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

the sh file
#/bin/sh
while read line ; do
echo $line
pip download $line
done < list_pkgname


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

The file of list_downloadname for verify/check and install

tensorflow-2.4.1-cp38-cp38-manylinux2010_x86_64.whl
wrapt-1.12.1.tar.gz
grpcio-1.32.0-cp38-cp38-manylinux2014_x86_64.whl
Keras_Preprocessing-1.1.2-py2.py3-none-any.whl
google_pasta-0.2.0-py3-none-any.whl
tensorflow_estimator-2.4.0-py2.py3-none-any.whl
tensorboard-2.5.0-py3-none-any.whl
h5py-2.10.0-cp38-cp38-manylinux1_x86_64.whl
numpy-1.19.5-cp38-cp38-manylinux2010_x86_64.whl
protobuf-3.15.8-cp38-cp38-manylinux1_x86_64.whl
typing_extensions-3.7.4.3-py3-none-any.whl
opt_einsum-3.3.0-py3-none-any.whl
absl_py-0.12.0-py3-none-any.whl
astunparse-1.6.3-py2.py3-none-any.whl
termcolor-1.1.0.tar.gz
six-1.15.0-py2.py3-none-any.whl
flatbuffers-1.12-py2.py3-none-any.whl
gast-0.3.3-py2.py3-none-any.whl
Markdown-3.3.4-py3-none-any.whl
google_auth-1.30.0-py2.py3-none-any.whl
tensorboard_data_server-0.6.0-py3-none-manylinux2010_x86_64.whl
tensorboard_plugin_wit-1.8.0-py3-none-any.whl
google_auth_oauthlib-0.4.4-py2.py3-none-any.whl
requests-2.25.1-py2.py3-none-any.whl
Werkzeug-1.0.1-py2.py3-none-any.whl
rsa-4.7.2-py3-none-any.whl
cachetools-4.2.2-py3-none-any.whl
pyasn1_modules-0.2.8-py2.py3-none-any.whl
requests_oauthlib-1.3.0-py2.py3-none-any.whl
pyasn1-0.4.8-py2.py3-none-any.whl
urllib3-1.26.4-py2.py3-none-any.whl
chardet-4.0.0-py2.py3-none-any.whl
idna-2.10-py2.py3-none-any.whl
oauthlib-3.1.0-py2.py3-none-any.whl

---------------------
sh file for checking download version

#/bin/sh
while read line ; do
if [ -f "$line" ]; then
#echo $line oo
echo oo
else
echo $line xx
fi

done < list_downloadname

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

for install local whl/gz file without net.

#/bin/sh
while read line ; do
if [ -f "$line" ]; then
pip install ./$line
#echo oo
else
echo $line xx
fi

done < list_downloadname

---------------------
Wish every engineer leaves the office on time.
If the note helps you, buy street cats a fish can.
全站分類:不分類 不分類
自訂分類:test
上一則: ubuntu 16 倉頡
下一則: linux script, often, for loop

限會員,要發表迴響,請先登入