Could not find Python executable
See original GitHub issueI just started using python so my apologies if the question sounds stupid.My web application is in php and i am calling gsutil from php using shell_exec.I am getting the following error
which: no python2 in ((null)) which: no python2.7 in ((null)) Traceback (most recent call last): File "/usr/local/bin/google-cloud-sdk/bin/bootstrapping/gsutil.py", line 75, in main() File "/usr/local/bin/google-cloud-sdk/bin/bootstrapping/gsutil.py", line 59, in main 'platform/gsutil', 'gsutil', *args) File "/usr/local/bin/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 45, in ExecutePythonTool execution_utils.ArgsForPythonTool(_FullPath(tool_dir, exec_name), *args)) File "/usr/local/bin/google-cloud-sdk/lib/googlecloudsdk/core/execution_utils.py", line 170, in ArgsForPythonTool python_executable = kwargs.get('python') or GetPythonExecutable() File "/usr/local/bin/google-cloud-sdk/lib/googlecloudsdk/core/execution_utils.py", line 59, in GetPythonExecutable raise ValueError('Could not find Python executable.') ValueError: Could not find Python executable.
My upload command is as follows
$upload_command = 'python="/usr/bin/python" /usr/local/bin/google-cloud-sdk/bin/gsutil -h "Cache-Control:max-age=31536000, public" cp ' . $tmp_path . ' gs://imgtest/'.$filename;
gcloud info
`Google Cloud SDK [138.0.0]
Platform: [Linux, x86_64] Python Version: [2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]] Python Location: [/usr/bin/python2] Site Packages: [Disabled]
Installation Root: [/usr/local/bin/google-cloud-sdk] Installed Components: core: [2016.12.09] core-nix: [2016.11.07] gcloud: [] gsutil-nix: [4.18] gsutil: [4.22] bq: [2.0.24] bq-nix: [2.0.24] System PATH: [/usr/local/bin/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin] Cloud SDK on PATH: [True] Kubectl on PATH: [False]
Installation Properties: [/usr/local/bin/google-cloud-sdk/properties] User Config Directory: [/root/.config/gcloud] Active Configuration Name: [default] Active Configuration Path: [/root/.config/gcloud/configurations/config_default] `
OS : Centos 7
Issue Analytics
- State:
- Created 7 years ago
- Reactions:6
- Comments:7 (1 by maintainers)
Top GitHub Comments
@khavishbhundoo Try this workaround.
Other references: #236
I had same issue when executing gcloud commands.
which: no python2 in (/opt/google-cloud-sdk/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin)
I resolve this by adding symbolic link to “/usr/bin/python”
ln -s /usr/bin/python /usr/bin/python2