![]() ![]() ![]() This command creates a new file called requirements.txt and fills it with the output of pip freeze. If you want to save your installed packages in a requirements file, then you can write: python -m pip freeze > requirements.txt This is precisely the format for the requirements.txt file I talked about before! Hmm… The format for the output seems familiar. The pip freeze command shows every installed Python package with the corresponding version number. If you want to know the Python packages installed on your system, then use the command pip freeze: python -m pip freeze Output: appdirs=1.4.4 atomicwrites=1.4.0 attrs=21.2.0 beautifulsoup4=4.9.3 black=21.7b0. There is usually not a good reason to break the convention, though. Also, the filename requirements.txt is a convention. You should know: The -r flag is shorthand for -requirements, so you might see both used. When your friend receives your project, she can simply run the command: python -m pip install -r requirements.txt Output: Successfully installed cycler-0.10.0 kiwisolver-1.3.1 matplotlib-3.4.2 pandas-1.3.1 pillow-8.3.1 seaborn-0.11.1 Make a file called requirements.txt in the project folder containing the three lines: numpy=1.21.1 pandas=1.3.1 seaborn=0.11.1 Luckily, there is a better way: A requirements.txt file. How tiresome would it be for your friend to install them (with the correct versions) one by one? However, they can not run the Python files unless they also have installed NumPy, Pandas, and Seaborn. The application is so cool that you have to share it with your friend. Your application only uses the three packages: Say you have made an awesome data science application in Python. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |