- Secret Recipes of the Python Ninja
- Cody Jackson
- 116字
- 2021-06-25 22:14:42
How to do it...
To create an archive (from the official documentation: https://pip.pypa.io/en/latest/user_guide/#installation-bundles), perform the following:
- Create a temporary directory:
$ tempdir = $(mktemp -d /tmp/archive_dir)
- Create a wheel file:
$ pip wheel -r requirements.txt --wheel-dir = $tempdir
- Let the OS know where to place the archive file:
$ cwd = `pwd`
- Change to the temporary directory and create the archive file:
$ (cd "$tempdir"; tar -cjvf "$cwd/<archive>.tar.bz2" *)
To install from an archive, do the following:
- Create a temporary directory:
$ tempdir=$(mktemp -d /tmp/wheelhouse-XXXXX)
- Change to the temporary directory and unarchive the file:
$ (cd $tempdir; tar -xvf /path/to/<archive>.tar.bz2)
- Use pip to install the unarchived files:
$ pip install --force-reinstall --ignore-installed --upgrade --no-index --no-deps $tempdir/*
推薦閱讀
- Unity 2020 Mobile Game Development
- Python零基礎(chǔ)快樂學(xué)習(xí)之旅(K12實戰(zhàn)訓(xùn)練)
- React.js Essentials
- Mastering LibGDX Game Development
- 秒懂設(shè)計模式
- 深入淺出Serverless:技術(shù)原理與應(yīng)用實踐
- Nginx實戰(zhàn):基于Lua語言的配置、開發(fā)與架構(gòu)詳解
- Scala程序員面試算法寶典
- Mastering Git
- Data Science Algorithms in a Week
- ASP.NET開發(fā)寶典
- ROS機(jī)器人編程實戰(zhàn)
- Building UIs with Wijmo
- Puppet Cookbook(Third Edition)
- Swift從入門到精通 (移動開發(fā)叢書)