Computing desk | ||
---|---|---|
< December 21 | << Nov | December | Jan >> | December 23 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
Can someone explain to me (Linux noob) what this lines of code do:
mkdir youtube-dl git clone --depth 1 --branch fix-function-sig-parser https://github.com/lanegramling/youtube-dl.git cd youtube-dl python3 -m pip install -e . --user
I understand 1 and 3, and I see that 2 gets the app from github. I just don't know why it has to be this combination of commands. Regarding pip, I have only seen 'pip install <package name>'
How are these lines different from:
apt-get install youtube-dl
--Bumptump (talk) 23:33, 22 December 2021 (UTC)
.
means "current directory"), as a "user install". See the pip documentation for details. Note that the official docs there instruct you to run pip with python -m pip
. I suspect $ pip
in your shell is just an alias or shell function that stands for that, put there by your system distributor. To find out, give type pip
a whirl.(edit conflict)::Hmm, I'd hope that rather more than a vague understanding is normal for a Linux user, but we'll let that pass. Card_Zero is on the right lines, the commands that Bumptump presented result in an editable python project in your home directory, owned by you the user. As well as exploring commands with -h
you need to get used to going to the manual first. For instance man mkdir
.
man git
and man git-clone
for full details. --depth 1
just gets a single branch. --branch fix-function-sig-parser
gets the branch called "fix-function-sig-parser" instead of the HEAD branch. Obviously https://github.com/lanegramling/youtube-dl.git
is where to find this github.python3
using the module pip
. The man page for this is at man pip3
. Pip will install the result editable in the current directory (ie youtube-dl) as an ordinary user./usr/bin/pip3
which invokes the python3 interpreter (via the Shebang (Unix) mechanism) to load in the pip module and run it. This is what happens if you just type pip3
. Your system may have a link from /usr/bin/pip
to /usr/bin/pip3
in which case you can just type "pip".youtube-dl
. The command will write to /usr/bin
and other system directories, so needs to be run as root, either directly or via sudo
.youtube-dl
then I would seriously recommend just installing it from the repository. That way you'll get a stable, supported, version. If you do want to build it yourself, please bear in mind that you may need to rebuild after some upgrades and no-one will warn you! At least though, building it as a user you will only mess up your account not the system! All the best, Martin of Sheffield (talk) 12:19, 23 December 2021 (UTC)git clone --depth 1 --branch fix-function-sig-parser https://github.com/lanegramling/youtube-dl.git python3 -m pip install -e ./youtube-dl --user
Accomplish the same. The git command creates a directory. BTW, in this case I got a recommendation to install this specific app in this way, since the app in the repository was buggy. And indeed this app didn't have the bug I was experiencing. Bumptump (talk) 00:48, 24 December 2021 (UTC)
cd
into the new directory immediately after mkdir
, to ensure, like I said, that all your work is "happening" in its own directory. In this case, you'd wind up with another subdirectory inside that directory, since that's Git's behavior, but this is trivial. Directories don't "cost" anything, and it pays off the first time it prevents the hassle of cleaning up a mess some program dumped unexpectedly in a directory where you didn't want that to happen. --47.155.96.47 (talk) 02:08, 24 December 2021 (UTC)