0

The problem with this question is that I do not the proper words to refer to my problem. Let me be clear about what I'm not asking. I'm not asking how to execute a python file. I can already do that. Simply cd to the director where the Python file is in, then run

>>>python module.py 

What I cannot do is the following: on this webpage:

https://github.com/pytube/pytube

You can download the software, then I think you have to put a new line in the bash file and then when you type in command line

$ pytube https://www.youtube.com/playlist?list=PLS1QulWo1RIaJECMeUT4LFwJ-ghgoSH6n

It will execute the module. I don't know how to do that and am asking how. Doubtlessly, this question is a duplicate but I do not know the proper keywords needed to find the answer to this question. When I google 'how to execute python modules from command line', all I get is instructions on how to do just that which I already know how to do.

0

2 Answers 2

0

The project that you are using is using setuptools to package the python scripts into an executable (See here).

If you want to package your own files into an executable, you can also use setuptools.

Or if you want something quick and easy, add to the start of your file:

#!/usr/bin/env python 

and then run chmod a+x module.py. After this you can run directly by writing ./module.py (If you don't want the .py, just rename the file and delete the .py). If you don't want the ./, just drag the file to /usr/local/bin

Sign up to request clarification or add additional context in comments.

Comments

-1

That's because the GitHub link in your post contains a library, not a module, and is not something you execute. You need to install the library so that you can use commands provided by the library.

You can install a library using pip, which should be included in your Python installation as long as it's recent.

$ python -m pip install pytube 

Once the library is installed, you then need to import the pytube package so you can use commands such as the one you mentioned from the command line or from within a Python script.

from pytube import YouTube 

This information is all contained within the GitHub readme.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.