title: How to get python output and print with php
body: <p>This my python file hi.py:</p>
  <pre><code>import pandas as pd
  import numpy as np
  from sklearn.metrics.pairwise import cosine_similarity
  from sklearn.feature_extraction.text import TfidfVectorizer
  
  data = pd.read_csv(&quot;C:/xampp/htdocs/product.csv&quot;)
  data['content'] = data['Brand']+' '+data['Title']+' '+data['Product Type']+' 
  '+data['Gender']+' '+data['Price'].astype(str)+' '+data['MRP'].astype(str)+' 
  '+data['Rating'].astype(str)
  
  from sklearn.feature_extraction.text import TfidfVectorizer
  vectorizer = TfidfVectorizer(max_features=1000)
  product_vectors = vectorizer.fit_transform(data['content'].values)
  
  
  from sklearn.metrics.pairwise import cosine_similarity
  similarity = cosine_similarity(product_vectors)
  
  def recommend(content):
  
   # find  index from dataset
   content_index = data[data['Title'] == content].index[0]
  
   # finding cosine similarities 
   distances = similarity[content_index]
  
  # sorting cosine similarities
   my_list = sorted(list(enumerate(distances)),reverse=True,key=lambda x:x[1])[1:10]
   dh=[]
  #return my_list
   for i in my_list:
      #print(data.iloc[i[0]].Title)
      dh.append(data.loc[i[0]].Title)
       #return dh
  print(recommend('Adidas Men Running Shoes'))
  </code></pre>
  <p>I need the list of recommended products to be printed in php localhost.
  This is my php file:</p>
  <pre><code>&lt;?php
  $output=shell_exec('py hi.py');
  echo $output;
  ?&gt;
  </code></pre>
  <p>However when I'm running the php file I'm getting output in VSCode but nothing is printed when I run on localhost.</p>
  <p>What might be the problem please help me.</p>