创建新的conda环境,在有网的机器上安装需要的python包
(base) peisen@Peisens-MateBook-X-Pro ~ % conda env list
# conda environments:
#
base * /Users/peisen/anaconda3
311pla-check /Users/peisen/anaconda3/envs/311pla-check
py311 /Users/peisen/anaconda3/envs/py311(base) peisen@Peisens-MateBook-X-Pro ~ %
(base) peisen@Peisens-MateBook-X-Pro ~ % source activate 311pla-check
执行 pip list查看都用了哪些包
(311pla-check) peisen@Peisens-MateBook-X-Pro PlagiarismCheck % pip list
Package Version
------------ -------
blinker 1.8.2
click 8.1.7
Flask 3.0.3
fuzzywuzzy 0.18.0
itsdangerous 2.2.0
Jinja2 3.1.4
MarkupSafe 2.1.5
pip 24.2
PyMySQL 1.1.1
setuptools 72.2.0
Werkzeug 3.0.4
wheel 0.44.0
(311pla-check) peisen@Peisens-MateBook-X-Pro PlagiarismCheck %
(311pla-check) peisen@Peisens-MateBook-X-Pro PlagiarismCheck %
(311pla-check) peisen@Peisens-MateBook-X-Pro PlagiarismCheck %
将安装的包转换成版本号文件
(311pla-check) peisen@Peisens-MateBook-X-Pro PlagiarismCheck %
pip freeze > requirements_20240903.txt
(311pla-check) peisen@Peisens-MateBook-X-Pro PlagiarismCheck %
(311pla-check) peisen@Peisens-MateBook-X-Pro PlagiarismCheck %
(311pla-check) peisen@Peisens-MateBook-X-Pro PlagiarismCheck %
(311pla-check) peisen@Peisens-MateBook-X-Pro PlagiarismCheck %
(311pla-check) peisen@Peisens-MateBook-X-Pro PlagiarismCheck % cat requirements_20240903.txt
blinker==1.8.2
click==8.1.7
Flask==3.0.3
fuzzywuzzy==0.18.0
itsdangerous==2.2.0
Jinja2==3.1.4
MarkupSafe==2.1.5
PyMySQL==1.1.1
Werkzeug==3.0.4
(311pla-check) peisen@Peisens-MateBook-X-Pro PlagiarismCheck %
根据版本号文件下载离线包
(311pla-check) peisen@Peisens-MateBook-X-Pro PlagiarismCheck % pip download -d 你要下载到的路径 -r requirements_20240903.txt
- 离线库快速安装
使用pip install --no-index --find-links=DIR -r PATH,其中DIR为离线库文件夹路径,PATH为离线库列表文件路径
pip3 install --no-index --find-links=依赖 -r requirements_20240903.txt