- 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
推薦閱讀
- Java程序設計(慕課版)
- 青少年軟件編程基礎與實戰(圖形化編程三級)
- Mastering AndEngine Game Development
- Scala謎題
- C#程序設計基礎:教程、實驗、習題
- 零基礎入門學習Python
- 大模型RAG實戰:RAG原理、應用與系統構建
- 數據結構案例教程(C/C++版)
- Mastering ROS for Robotics Programming
- Kotlin編程實戰:創建優雅、富于表現力和高性能的JVM與Android應用程序
- Java編程的邏輯
- 零基礎學Kotlin之Android項目開發實戰
- 開源項目成功之道
- GameMaker Essentials
- Python物理建模初學者指南(第2版)