简体   繁体   English

Linux:Curl 已安装但 -bash: :curl: 命令未找到

[英]Linux: Curl installed but -bash: :curl: command not found

Running Debian Stretch on an r710.在 r710 上运行 Debian Stretch。 Using the non-free/contrib build for driver support.使用 non-free/contrib 构建来支持驱动程序。

When I try to use packages that I've installed (curl, zpool, etc), I have to include the path to the package... Which is a pain when I don't always know where packages install to.当我尝试使用已安装的包(curl、zpool 等)时,我必须包含包的路径......当我并不总是知道包安装到哪里时,这很痛苦。

Two questions:两个问题:

  1. How do I remedy the path issue in the short term?如何在短期内解决路径问题?
  2. How do I amend Debian so that when packages are installed, their paths update/install automatically?如何修改 Debian,以便在安装软件包时,它们的路径会自动更新/安装?

Find where the command is stored by查找命令的存储位置

which <command>

Either you can try run curl from the output above for example /usr/bin/curl then try execute this:您可以尝试从上面的输出中运行 curl 例如 /usr/bin/curl 然后尝试执行以下操作:

 /usr/bin/curl

For a temporary fix until you solve the real problem you can do:对于临时修复,直到您解决真正的问题,您可以执行以下操作:

cd /usr/local/bin; ln -s $(which curl) curl

Or you can just set an alias:或者你可以设置一个别名:

echo "alias curl='$(which curl)'" >> ~/.bashrc; . ~/.bashrc

Troubleshoot your problem:解决您的问题:

Check so PATH folder has the correct paths exported:检查 PATH 文件夹是否导出了正确的路径:

printf "%s\n" $PATH

Modify current PATH修改当前 PATH

Use the export command to add new paths and see if that works you can then update your ~/.bashrc or ~/.bash_profile, but first you can try in shell without adding it permanent to $PATH使用 export 命令添加新路径,看看是否可行,然后您可以更新 ~/.bashrc 或 ~/.bash_profile,但首先您可以在 shell 中尝试,而不将其永久添加到 $PATH

export PATH=$PATH:/missed/bin/folder

To format your PATH variable for easy viewing in future you can add below function to your .bashrc要格式化您的 PATH 变量以便将来查看,您可以将以下函数添加到您的 .bashrc

function path(){
    old=$IFS
    IFS=:
    printf "%s\n" $PATH
    IFS=$old
 }

Just install it by:只需通过以下方式安装它:

apt install curl安装卷曲

or sudo apt install curl或 sudo apt install curl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM