[Errno2] in python What is the solution to the No such file or directory: 'python': 'python'?

Asked 2 years ago, Updated 2 years ago, 110 views

The error "[Errno2]" when trying to turn the python script below. No such file or directory: 'python' appears.
I don't know how to solve it, so please let me know.

What I'm doing is I'm trying to create a BERT that I learned on Wikipedia, and I'm trying to do that pre-learning step.
Since there is a lot of input to run from the terminal, we assume that the following python script is created and executed to automatically pre-learn.

The execution environment is nvidia-docker, and the container base is ubuntu18.04, where you are trying to install python and so on in the container.
tensorflow-gpu==1.15.0

import tensorflow as tf
import subprocess

print(tf.__version__)

input_data_gcs='/work/data'

target_dirs = [
    'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN',
    'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ', 'BA', 'BB',
    'BC', 'BD', 'BE'
]

max_seq_len = 512

input_file=', '.join([{}/wiki/{}/all_maxseq{}.tfrecord'.format(input_data_gcs,elem,max_seq_len)for elemin target_dirs])

output_gcs = '/work/model'

cmd = ('python')
       './src/run_pretraining.py'
       '--input_file={}'
       '--output_dir={}'
       '--do_train=True'
       '--do_eval=True'
       '--train_batch_size=64'
       '--max_seq_length={}'
       '--max_predictions_per_seq=20'
       '--num_train_steps=1400000'
       '--num_warmup_steps=10000'
       '--save_checkpoints_steps=10000'
       '--learning_rate=1e-4'
       .format(input_file, output_gcs, max_seq_len))
subprocess.run(cmd.split())

The following error will be printed using this code, and the process is not progressing.

FileNotFoundError: [Errno2] No such file or directory: 'python': 'python'

I look forward to hearing from someone.

python python3 machine-learning

2022-09-30 17:10

1 Answers

python3As this is a question with the tag,
Assume you installed Python with apt install python3.

You must use the python3 command instead of the python command.


2022-09-30 17:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.