douweiduo7526 2019-02-08 01:29
浏览 146

通过网站安装Python模块

I recently have a website running a python script. Unfortunately, this python script requires another python module but I do not know how to install it on the website. How do you install a python module for a website. Below is my code

PHP:

<?php

$VAR = 'test';
$output = shell_exec('python test.py ' . $VAR);
//$output = shell_exec('python -m pip install requests'); <-- tried that but does not work.

echo $output;
?>

Python Code:

import requests

response = requests.get('google.com')
print (response.text)

I do not get anything when I go to my php page, but if I hastag import requests and response and print and just put "print ("Hi")" it works. Any ideas on how to install requests?

Is there anyway I can get a shell for a website?

NOTE: I AM USING CPANEL.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料
    • ¥15 使用R语言marginaleffects包进行边际效应图绘制
    • ¥20 usb设备兼容性问题
    • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
    • ¥15 安装svn网络有问题怎么办