Python - What is difference between a direct import and a dependency file for installing packages?
Oziwag (0)

Previously I would just use the import statement for packages but after reading the page on installing packages I found out about using a requirements.txt file. I'm wondering what the difference is and which I should use.

You are viewing a single comment. View All
Scoder12 (348)

The requirements.txt file just tell what to install. You still need to use the same import statements whether you use a requirements.txt or not. Generally requirements.txt is better because the auto install doesn't always work and plus you can specify things such as custom versions by using somepackage==1.2.3 where 1.2.3 is the version number.

I am a helper. If this helped you, please consider marking as the answer and/or upvoting.