# py-run **Repository Path**: chenjobin/py-run ## Basic Information - **Project Name**: py-run - **Description**: python代码运行 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2021-07-20 - **Last Updated**: 2023-06-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # py-run #### 介绍 python代码运行 #### 软件架构 软件架构说明 python3.8 #### 安装教程 1. docker镜像已经制作,pull以后,需要 ```shell docker run -it --restart=always -p 39093:39093 -d py-run-server:v1.5 /start.sh 或者 docker run -it --restart=always -p 39093:39093 -d python-run:v1.5 /start.sh ``` 这样,就可以用了 2. 部署:可能会遇到vue ngnix 405问题,参考default文件里的内容,当前前提是配合vuemooc-front的这种vue.config.js V1.2.14 3. xxxx #### 使用说明 1. 打算做成docker,来用,安装了requirements.txt。有几个安装不上,可能是版本?docx模块不支持doc文件,切记 2. 该文件夹放在/home ,,python3.8.10 而且还得额外安装psutil模块 3. EXEC = '/usr/bin/python' 这个是python默认解释器位置,一定要将这个指向Python3(其实就是设置Python3为默认) 4. 写python需要使用上传的网络文件是,使用以下代码,放在最前面,然后就相当于在py服务器本地用户临时文件夹有3.txt,直接读取就好。 ```python from urllib import request import os request.urlretrieve("http://cdn.oss.chenzhibin.vip/media/py_run/2021/07/requirements.txt",os.path.split(__file__)[0]+"/3.txt") read_file= os.path.split(__file__)[0]+"/3.txt" with open(read_file, 'r') as f: # 1、read():读取文件全部内容 str_data = f.read() print(str_data) print("helloworld") ``` 如果需要保存到某个特定文件夹,那么可以用(windows方法可不一样,要用newdir = os.getcwd() + '\\pkg\\') ```python from urllib import request import os newdir = os.path.split(__file__)[0]+ '/pkg/' if not os.path.exists(newdir): #判断当前路径是否存在,没有则创建pkg文件夹 os.makedirs(newdir) request.urlretrieve("http://cdn.oss.chenzhibin.vip/media%2Fpy_run%2F2021%2F08%2Futils1.py",newdir+"/utils1.py") ``` #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)