python:无法打开文件"帮助":[错误2]没有这样的文件或目录



我正在尝试在我的cpanel项目上安装python软件包。但面临奇怪的问题。以下是各种命令的面板输出:

[root@host myproject]# python
Python 2.7.5 (default, Apr 11 2018, 07:36:10)[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2Type "help", "copyright", "credits" or "license" for more information.

当我尝试命令帮助时,请得到以下响应:

[root@host myproject]# python help
python: can't open file 'help': [Errno 2] No such file or directory

我正在尝试从名为"myproject"的项目目录中安装软件包。安装软件包时,我得到相同的响应:

[root@host myproject]# python install requests
python: can't open file 'install': [Errno 2] No such file or directory[root@host myproject]#

我从错误日志中了解到的是 python 命令不起作用/无法识别。我已经搜索了各种解决方案,但找不到有关此问题的任何解决方案。这里有人可以帮助我强调我可能犯的错误吗?以及如何解决这个问题?

简而言之:

要显示命令帮助,您需要运行

python --help

(不是python help,它指示 Python 运行一个名为help的文件(

要安装软件包,您需要运行pip(python包管理器(:

pip install your-package-name

当您调用python help时,您正在尝试打开文件help。你想要的是打电话给python --help.如果要安装请求,可以执行pip install requests

最新更新