- Secret Recipes of the Python Ninja
- Cody Jackson
- 244字
- 2021-06-25 22:14:40
Utilizing requirement files and resolving conflicts
As mentioned previously, a requirements file, requirements.txt, can be created to provide a list of packages to install all at once, via pip install -r requirements.txt. The requirements file can specify specific or minimum versions, or simply specify the library name and the latest version will be installed.
It should be noted that files pulled from the requirements file aren't necessarily installed in a particular order. If you require certain packages to be installed prior to others, you will have to take measures to ensure that the installation is sequential, such as having multiple pip install calls.
Requirements files can specify version numbers of packages explicitly. For example, two different modules (m1 and m2) both depend on a third module (m3). The module m1 requires m3 to be at least version 1.5, but m2 requires it to be no later than version 2.0; the current version of m3 is 2.3. In addition, the latest version of m2 (version 1.7) is known to contain a bug.
Hash digests can be used in requirements files to verify downloaded packages to guard against a compromise of the PyPI database or the HTTPS certificate chain. This is actually a good thing, as in 2017 ten Python libraries (https://www.bleepingcomputer.com/news/security/ten-malicious-libraries-found-on-pypi-python-package-index/) uploaded to PyPI were found to be hosting malicious files.
Because PyPI does not perform any security checks or code auditing when packages are uploaded, it is actually very easy to upload malicious software.
- 數(shù)據(jù)庫程序員面試筆試真題與解析
- Offer來了:Java面試核心知識點精講(原理篇)
- 微信公眾平臺開發(fā):從零基礎(chǔ)到ThinkPHP5高性能框架實踐
- Access 2016數(shù)據(jù)庫管
- Learning FuelPHP for Effective PHP Development
- 從零開始學(xué)Linux編程
- 持續(xù)輕量級Java EE開發(fā):編寫可測試的代碼
- Python網(wǎng)絡(luò)爬蟲技術(shù)與應(yīng)用
- Anaconda數(shù)據(jù)科學(xué)實戰(zhàn)
- 數(shù)據(jù)科學(xué)中的實用統(tǒng)計學(xué)(第2版)
- C語言程序設(shè)計
- Learning Kotlin by building Android Applications
- Java程序設(shè)計及應(yīng)用開發(fā)
- MATLAB計算機(jī)視覺實戰(zhàn)
- Puppet Cookbook(Third Edition)