python版本

import sys

def main():
 
    return {
        "result": str(sys.version_info)
    }

推荐包

# python-requirements.txt 推荐版本

numpy==1.24.3
pandas==2.0.3

定位sandabox

cd F:\大模型\dify-1.9.2\docker\volumes\sandbox\dependencies

新建python-requirements.txt

放包

安装--重启docker

docker compose down
docker compose up -d

查看下载日志--是否成功安装

docker logs -f docker-sandbox-1

修改配置

#进入--先备份
F:\大模型\dify-1.9.2\docker\volumes\sandbox\conf

#编辑文件:

config.yaml
app:
  port: 8194
  debug: True
  key: dify-sandbox
max_workers: 4
max_requests: 50
worker_timeout: 5
python_path: /usr/local/bin/python3
enable_network: True # please make sure there is no network risk in your environment
#---注释掉下面一行
# allowed_syscalls: # please leave it empty if you have no idea how seccomp works  
proxy:
  socks5: ''
  http: ''
  https: ''‘
#添加下面的内容
allowed_syscalls: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,28,30,31,32,33,34,35,36,37,39,56,57,60,61,62,63,72,73,80,81,85,86,90,91,105,106,131,186,202,204,217,231,233,234,237,257,262,273,281,291,318,334,435,499,318,334,307,262,16,8,217,1,3,257,0,202,9,12,10,11,15,25,105,106,102,39,110,186,60,231,234,13,16,24,273,274,334,228,96,35,291,233,230,270,201,14,131,318,56,258,83,41,42,49,50,43,44,45,51,47,52,54,271,63,46,307,55,5,72,138,7,281]
python_pip_mirror_url: https://pypi.tuna.tsinghua.edu.cn/simple

导入依赖报错:重启沙箱

# 停止容器 docker stop docker-sandbox-1

# 启动容器 docker start docker-sandbox-1

参考:https://panjistack.blog.csdn.net/article/details/151833548?fromshare=blogdetail&sharetype=blogdetail&sharerId=151833548&sharerefer=PC&sharesource=moriatygirl&sharefrom=from_link

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐