-2

I Have A Project Which Uses Many Python Libraries And I Want To Share This Project With My Friends And Many Others. But, I Don't Know If Their Computers Will Have Those Packages Installed On Their Computers. So I Wanted To Make A requirements.txt File. When pip install requirements.txt Is Run It Will Automatically Installs The Uninstalled Packages.

I Want To Put The Names Of The Packages Which Are Deafautly Not Installed Such As Kivy, Matplotlib, Numpy. Some Default Installed Packages Are Random etc. So I Don't Want To Put These Names In The requirements.txt File.

Please Help Me Out On This. Thank You!!

Dhruv_2676
  • 101
  • 1
  • 9
  • 1
    Just do `pip freeze > requirements.txt`. Voila. – Czaporka Mar 13 '21 at 10:51
  • 2
    Does this answer your question? [How to create a requirements.txt?](https://stackoverflow.com/questions/29938554/how-to-create-a-requirements-txt) – theProcrastinator Mar 13 '21 at 10:52
  • 3
    Does this answer your question? [Automatically create requirements.txt](https://stackoverflow.com/questions/31684375/automatically-create-requirements-txt) – Czaporka Mar 13 '21 at 10:53
  • 1
    @Czaporka Got The Answer In The Question Link You Provided. Didn't See Such Questions Before Asking One Myself. Sorry For The Inconvenience Caused To Anyone. Thank You For The Answer. – Dhruv_2676 Mar 14 '21 at 12:07

2 Answers2

0

It seems like you aren't using virtual environments. You can create a virtual environment for your Python package on your machine. The process is very simple. Please follow the official Python documentation for setting up a virtual env for your project. https://docs.python.org/3/tutorial/venv.html

Test the package inside this virtualenv. This would require you to install all the required dependencies inside this virtualenv.

From here you can run:

pip freeze > requirements.txt

to generate the requirements.txt file.

Ramit Mittal
  • 483
  • 3
  • 12
  • This Generates A Requirements.txt File For All The Extra Modules You Have Installed On Your Computer. So You Have To Make A Virtual Environment Then Put Your Files In There And Then Run This Again. Which Takes A Lot Of Time. But, Thanks For The Effort You Put Into Providing This Answer. – Dhruv_2676 Mar 14 '21 at 12:09
  • I understand that using virtualenvs seems like an extra hurdle but using them to isolate dependencies is an established best practice for python projects. – Ramit Mittal Mar 14 '21 at 19:26
-1

Try this , it will print all modules

help('modules')