hello 大家好,最近小编在用dockercompose部署wordpress遇到了一个很无语的问题

[root@200250229-registry ~]# pip install docker-compose
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Requirement already satisfied: docker-compose in /usr/local/python3.10/lib/pyt0/site-packages (1.29.2)
Requirement already satisfied: PyYAML<6,&gt;=3.10 in /usr/local/python3.10/lib/py10/site-packages (from docker-compose) (5.4.1)
Requirement already satisfied: python-dotenv<1,&gt;=0.13.0 in /usr/local/python3./python3.10/site-packages (from docker-compose) (0.20.0)
Requirement already satisfied: websocket-client<1,&gt;=0.32.0 in /usr/local/pytholib/python3.10/site-packages (from docker-compose) (0.59.0)
Requirement already satisfied: dockerpty<1,&gt;=0.4.1 in /usr/local/python3.10/lion3.10/site-packages (from docker-compose) (0.4.1)
Requirement already satisfied: docker[ssh]>=5 in /usr/local/python3.10/lib/pyt0/site-packages (from docker-compose) (5.0.3)
Requirement already satisfied: distro<2,>=1.5.0 in /usr/local/python3.10/lib/p.10/site-packages (from docker-compose) (1.7.0)
Requirement already satisfied: texttable<2,>=0.9.0 in /usr/local/python3.10/lion3.10/site-packages (from docker-compose) (1.6.4)
Requirement already satisfied: docopt<1,>=0.6.1 in /usr/local/python3.10/lib/p.10/site-packages (from docker-compose) (0.6.2)
Requirement already satisfied: jsonschema<4,>=2.5.1 in /usr/local/python3.10/lhon3.10/site-packages (from docker-compose) (3.2.0)
Requirement already satisfied: requests<3,>=2.20.0 in /usr/local/python3.10/lion3.10/site-packages (from docker-compose) (2.27.1)
Requirement already satisfied: paramiko>=2.4.2 in /usr/local/python3.10/lib/py10/site-packages (from docker[ssh]>=5->docker-compose) (2.10.3)
Requirement already satisfied: six>=1.3.0 in /usr/local/python3.10/lib/python3te-packages (from dockerpty<1,>=0.4.1->docker-compose) (1.16.0)
Requirement already satisfied: setuptools in /usr/local/python3.10/lib/python3te-packages (from jsonschema<4,>=2.5.1->docker-compose) (58.1.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /usr/local/python3.10/libn3.10/site-packages (from jsonschema<4,>=2.5.1->docker-compose) (0.18.1)
Requirement already satisfied: attrs>=17.4.0 in /usr/local/python3.10/lib/pyth/site-packages (from jsonschema<4,>=2.5.1->docker-compose) (21.4.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/python3.10/libn3.10/site-packages (from requests<3,>=2.20.0->docker-compose) (2021.10.8)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/python3.10/lib/pythosite-packages (from requests<3,>=2.20.0->docker-compose) (3.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/python3.10/thon3.10/site-packages (from requests<3,>=2.20.0->docker-compose) (1.26.9)
Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/python3b/python3.10/site-packages (from requests<3,>=2.20.0->docker-compose) (2.0.12)
Requirement already satisfied: bcrypt>=3.1.3 in /usr/local/python3.10/lib/pyth/site-packages (from paramiko>=2.4.2->docker[ssh]>=5->docker-compose) (3.2.0)
Requirement already satisfied: pynacl>=1.0.1 in /usr/local/python3.10/lib/pyth/site-packages (from paramiko>=2.4.2->docker[ssh]>=5->docker-compose) (1.5.0)
Requirement already satisfied: cryptography>=2.5 in /usr/local/python3.10/lib/3.10/site-packages (from paramiko>=2.4.2->docker[ssh]>=5->docker-compose) (36.
Requirement already satisfied: cffi>=1.1 in /usr/local/python3.10/lib/python3.e-packages (from bcrypt>=3.1.3->paramiko>=2.4.2->docker[ssh]>=5->docker-compos15.0)
Requirement already satisfied: pycparser in /usr/local/python3.10/lib/python3.e-packages (from cffi>=1.1->bcrypt>=3.1.3->paramiko>=2.4.2->docker[ssh]>=5->doompose) (2.21)
WARNING: Running pip as the 'root' user can result in broken permissions and cting behaviour with the system package manager. It is recommended to use a virnvironment instead: https://pip.pypa.io/warnings/venv
[root@200250229-registry ~]# docker-compose version
-bash: docker-compose: command not found
#小编我是真无语,明明已经安装成功,却提示命令找不到!

接下来尝试find命令去搜一下看看我到底有没有安装成功docker-compose

[root@200250229-registry ~]# find / -name "docker-compose*"
/usr/local/python3.10/bin/docker-compose

#在这里我们可以发现,docker-compose在这台机子已经被安装成功了

#接下来我们进入到/usr/local/python3.10/bin/docker-compose中并直接执行 version命令

[root@200250229-registry ~]# /usr/local/python3.10/bin/docker-compose version
docker-compose version 1.29.2, build unknown
docker-py version: 5.0.3
CPython version: 3.10.4
OpenSSL version: OpenSSL 1.1.1n  15 Mar 2022

#我们可以查看docker-compose的版本信息了。说明安装成功
#然而我们再次切换到~下,再次执行docker-compose verson依然没有用
[root@200250229-registry ~]# docker-compose version
-bash: docker-compose: command not found
#朋友们,接下来应该知道怎么解决了吧

看来是docker-compose没有加入到/usr/bin中,这个时候我们只需要建立一个链接就完事!

[root@200250229-registry ~]# ln -s /usr/local/python3.10/bin/docker-compose /usr/bin/docker-compose 

#建立软链接就相当于在windows系统中给软件添加一个快捷方式

[root@200250229-registry ~]# docker-compose version
docker-compose version 1.29.2, build unknown
docker-py version: 5.0.3
CPython version: 3.10.4
OpenSSL version: OpenSSL 1.1.1n  15 Mar 2022
#看完之后,猛然发现自己linux掌握的还不够

ok,问题解决了?

总结

当下次我们再遇到-bash: xxxxx: command not found的命令的时候有以下解决办法

  1. 检查自己有没有安装这个软件(可以使用find / –namexxxx*”)查看没有东西就去安装
  2. 在/usr/bin下面查看是否有该命令。如果没有的话创建一个连接:ln -s /usr/local/xxxxx/bin/docker-compose /usr/bin/xxx

原文地址:https://blog.csdn.net/weixin_55418082/article/details/124346536

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_13703.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注