- Secret Recipes of the Python Ninja
- Cody Jackson
- 112字
- 2021-06-25 22:14:40
How to do it...
Manually create requirements.txt by typing in the packages to include in the project. The following is an example from https://pip.pypa.io/en/latest/reference/pip_install/#requirements-file-format:
- Alternatively, run pip freeze > requirements.txt. This automatically directs the currently installed packages to a properly formatted requirements file.
- To implement hash-checking mode, simply include the digest with the package name in the requirements file, demonstrated below:
FooProject == 1.2 --hash=sha256:<hash_digest>
Note: Supported hash algorithms include: md5, sha1, sha224, sha384, sha256, and sha512.
- If there are module conflicts, or special versioning is needed, provide the first module required:
m1
- Indicate the second module, but ensure the version installed pre-dates the known bad version:
m2<1.7
- Provide the third module, ensuring it is at least equal to the minimum version required, but no greater than the maximum version that can be used:
m3>=1.5, <=2.0
While the preceding screenshot shows some version specifier requirements, here is an example showing some of the different ways to specify module versions in requirements.txt:
flask
flask-pretty == 0.2.0
flask-security <= 3.0
flask-oauthlib >= 0.9.0, <= 0.9.4
推薦閱讀
- Python機(jī)器學(xué)習(xí):數(shù)據(jù)分析與評(píng)分卡建模(微課版)
- Mastering RabbitMQ
- 跟“龍哥”學(xué)C語(yǔ)言編程
- C/C++算法從菜鳥到達(dá)人
- Cassandra Design Patterns(Second Edition)
- 精通API架構(gòu):設(shè)計(jì)、運(yùn)維與演進(jìn)
- 名師講壇:Java微服務(wù)架構(gòu)實(shí)戰(zhàn)(SpringBoot+SpringCloud+Docker+RabbitMQ)
- Yocto for Raspberry Pi
- Symfony2 Essentials
- Learning SciPy for Numerical and Scientific Computing(Second Edition)
- 區(qū)塊鏈底層設(shè)計(jì)Java實(shí)戰(zhàn)
- Lighttpd源碼分析
- Access 2010數(shù)據(jù)庫(kù)應(yīng)用技術(shù)實(shí)驗(yàn)指導(dǎo)與習(xí)題選解(第2版)
- Advanced UFT 12 for Test Engineers Cookbook
- ActionScript 3.0從入門到精通(視頻實(shí)戰(zhàn)版)