current position:Home>Ubuntu has Python libraries installed and cannot run command not found from the command line

Ubuntu has Python libraries installed and cannot run command not found from the command line

2022-07-25 10:30:20Haulyn5

Solution

For example, the library is installed runlike , But enter the command directly and prompt after entering Command not found, Refer to the following solutions .( take runlike Replace with the name of the library you installed )

programme 1:

If you only need to execute once , In a hurry, you can use this one-time solution . Add  ~/.local/bin, Use absolute path . Examples of the original command and the modified corresponding command are as follows .

#runlike   Using the command directly will prompt  command not found,  Add the previous path according to the following command to successfully execute 
~/.local/bin/runlike

programme 2:

Once and for all , Direct will ~/.local/bin/ Path join PATH, In this way, it will be retrieved in this path when executing relevant commands .

export PATH="$HOME/.local/bin:$PATH"

background

Need to use recently docker, Long ago run The container of , Want to run A similar , Then I found it runlike library , Requirements can be fulfilled .runlike It's a python The library of , But the execution is directly in bash Internal input runlike Executive . However, the actual operation encountered Command not found.

At first, it was speculated that python2 and python3 Problems with multiple versions , But in fact, it's not . The general reason is linux Next , Executable scripts are put into  ~/.local/bin This directory . However, this directory has not been added PATH, So lead to bash The program couldn't find runlike. Students who are not familiar with script programming can add PATH Relevant knowledge .

Maybe the wrong roast :Python2 Total abandonment ,Python3 Many versions stop supporting 2022 year ,Ubuntu Use pip and python And mark python3 perhaps pip3, tired .

Roast again : What does the quality of the new article suggest ……It looks like it discriminates against blogs with less than 1000 words.

Reference material

https://stackoverflow.com/questions/35898734/pip-installs-packages-successfully-but-executables-not-found-from-command-linehttps://stackoverflow.com/questions/35898734/pip-installs-packages-successfully-but-executables-not-found-from-command-line

copyright notice
author[Haulyn5],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/206/202207250923444517.html

Random recommended