-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wugenqiang
committed
May 19, 2022
1 parent
4b1d119
commit 470a51b
Showing
38 changed files
with
1,326 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Conda命令清理pkgs,一次完美的“瘦身”之旅 | ||
|
||
> 随着Python编程学习的不断深入,Anaconda所占的空间也越来越大,这几天在弄预测器部署到云服务器的事情,因为`内存空间不足`的问题导致我配置环境的依赖包根据安装不了,所以开始萌生出`把服务器瘦身`的冲动。 | ||
下图是清理前的服务器状态: | ||
|
||
![](../../../images/20220506-01-清理pkgs.png) | ||
|
||
我们发现,随着部署服务器上的预测器越来越多,可用的空间越来越少了!!!那这么少的空间,我咋部署我的呢,着实头疼,问了实验室好几个人,都没办法解决,就更头疼了,也是很巧,睡了一觉起来,今早就解决了这个问题,着实很开心 ☘️ 撒花 🎉 | ||
|
||
效果如下图所示,成功将内存使用率降到了84%。 | ||
|
||
![](../../../images/20220506-02-清理pkgs.png) | ||
|
||
下面来介绍一下如何操作的吧: | ||
|
||
首先,查阅资料发现,Anaconda文件夹下有一个pkgs文件夹,里面存放着各种包的使用过的各个版本及其压缩包,当你执行更新操作的时候,新版本和旧版本都会存在在pkgs文件夹里,同时我们知道,真正对Anaconda有用的文件夹是`lib/site-packages`,所以我大胆猜测,pkgs文件夹下的文件能删!!! | ||
|
||
于是萌生一种想法:执行以下命令操作: | ||
|
||
```shell | ||
# 删除pkgs | ||
rm -rf pkgs | ||
# 创建pkgs文件夹 | ||
mkdir pkgs | ||
``` | ||
|
||
但是,想想这样太粗暴了,万一删出问题,可就goodbye了 💥 毕竟云服务器是课题组的共有财产,删出问题可不得了哇!于是找到了一种稳妥的删除方式,亲测有效,如下: | ||
|
||
那就是使用`conda`命令进行清理,有如下3种方式: | ||
|
||
```shell | ||
conda clean -p # 删除没有使用的包(非常推荐,我就是用的这种) | ||
conda clean -t # 清理缓存的压缩包文件,可以试试,我没操作这个 | ||
conda clean -y -all # 删除全部的安装包及cache,可以试试,我没操作这个 | ||
``` | ||
|
||
推荐直接使用`conda clean -p`即可,这个命令已经可以清理出很大的空间了 | ||
|
||
执行这条命令:`conda clean -p`,会自动检查Anaconda中哪些包没有在包缓存中被硬依赖到其他地方: | ||
|
||
![](../../../images/20220506-03-清理pkgs.png) | ||
|
||
我们会看到,总共检查到足足5.13G的缓存!!赶紧输入`y`,迫切的将其删除~~ | ||
|
||
![](../../../images/20220506-04-清理pkgs.png) | ||
|
||
然后就清理出5.13G的可用空间,真香,然后顺顺利利的将预测器部署到了服务器上,希望可以帮助到你 ✨ | ||
|
||
下面附一张手画的预测器主页面图,作为本文的结尾,希望可以给你以启迪,给你带来帮助 🌈 | ||
|
||
![](../../../images/20220506-05-清理pkgs.png) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# 基于Flask构建预测器遇到的问题 | ||
|
||
> 本文操作基于编程平台:PyCharm,如使用其他编程平台,请根据实际情况进行解决。 | ||
## 问题一:预测器报错:OSError: [Errno 48] Address already in use | ||
|
||
> 昨天在构建`pSuc-EDBAM`预测器的时候,预测器正在运行时,准备关闭PyCharm,这时提示下图所示,不小心点到了`Disconnect`,重新运行报错:`OSError: [Errno 48] Address already in use` | ||
![](../../../images/20220505-01-pSuc-EDBAM.png) | ||
|
||
重新运行报错: | ||
|
||
![](../../../images/20220505-02-pSuc-EDBAM.png) | ||
|
||
🍀 那如何解决呢?请看下面: | ||
|
||
使用`lsof -i:端口号`可以查看占用某个端口的进程,我们在基于Flask框架构建预测器的时候,默认网址:127.0.0.1:5000,端口号是5000,所以解决方案如下: | ||
|
||
步骤一:打开PyCharm中Terminal命令行,输入:`lsof -i:5000`,查看占用5000端口的PID; | ||
|
||
步骤二:然后执行`kill -9 PID`即可杀掉该进程。 | ||
|
||
重新运行程序,即可运行成功: | ||
|
||
![](../../../images/20220505-03-pSuc-EDBAM.png) | ||
|
||
## 问题二:云服务器出现-bash: fork: retry: Resource temporarily unavailable错误 | ||
|
||
> 在云服务器上操作时,出现`-bash: fork: retry: Resource temporarily unavailable`错误,继而登陆不了服务器,The server refused to start a shell. | ||
起因是啥呢,是因为我在登陆服务器后执行ls命令,导致`-bash: fork: retry: Resource temporarily unavailable` | ||
|
||
![](../../../images/20220505-04-pSuc-EDBAM.png) | ||
|
||
本质原因就是因为Linux操作系统无法创建更多进程,导致出错,所以我需要解决的就是扩大用户的进程,就要去修改Linux最大进程数: | ||
|
||
步骤一:通过**ulimit -a**来查看当前Linux系统的一些系统参数,然后发现默认的`max user processes`只有1024 | ||
|
||
步骤二:执行` sudo vim /etc/security/limits.d/90-nproc.conf`操作,修改`max user processes`的值,我把它修改成了4096,看你还嫌少不,哼~ | ||
|
||
![](../../../images/20220505-05-pSuc-EDBAM.png) | ||
|
||
还好,最后pSuc-EDBAM预测器构建成功了,fighting!希望可以帮助到你 ☘️ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Gitpod——强大的在线IDE | ||
|
||
> Gitpod是一个强大的在线IDE(集成编程环境),提供了VSCode风格的编辑器,允许在线编写代码完成开发。Gitpod基于容器技术,可以帮助我们一键编译、构建、运行任何Github项目,而且每个项目的运行都是相互隔离的,随用随创建、用完可随时回收,非常灵活。 | ||
界面如下图所示: | ||
|
||
![](../images/20220511-01-Gitpod.png) | ||
|
||
注:如果是看中了一个Github项目,但是不想在本地去搭建各种环境去查看项目的运行效果,那么最好的方式就可以利用Gitpod来构建在线的IDE。 | ||
|
||
![](../images/20220511-02-Gitpod.png) | ||
|
||
Gitpod中的IDE基于Theia,这是一个开源项目,我们可以将其视为VS Code的在线版本。Theia是一个真正的开源项目,由Eclipse Foundation托管,由TypeFox,Ericsson,Red Hat,Arm等的各类工程师开发。Theia基于VS Code及其语言服务协议,支持大多数主流编程语言。 | ||
|
||
### 如何使用Gitpod | ||
|
||
(示例)在Chrome浏览器中输入: | ||
|
||
https://gitpod.io/#/github.com/wugenqiang/pSuc-EDBAM | ||
|
||
注意,`github.com/wugenqiang/pSuc-EDBAM`代表你要运行的Github项目。 | ||
|
||
即可进入到相应的运行界面啦,具体的可以自行操作看看。 | ||
|
||
### 如何运行项目 | ||
|
||
以`pSuc-EDBAM`举例: | ||
|
||
这个项目里面有一个`predict.py`文件,这是我构建好的预测琥珀酰化的文件,在命令行执行`python predict.py`即可运行,得出想要的预测结果。 | ||
|
||
![](../images/20220511-03-Gitpod.png) | ||
|
||
希望可以帮助到你 ☘️ | ||
|
2 changes: 1 addition & 1 deletion
2
ToolBox/VSCode插件推荐/01-VSCode安装.md → ToolBox/VSCode/01-VSCode下载.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# 修改VSCode底部状态栏颜色 | ||
|
||
Step 1: 首先,点击左下角齿轮⚙️,点击设置; | ||
|
||
Step 2: 搜索:`workbench.colorCustomizations`,然后点击在`settings.json中编辑`; | ||
|
||
![](../../images/20220516-01-VSCode.png) | ||
|
||
Step 3: 修改`settings.json`内容,在 `workbench.colorCustomizations`中添加三行代码即可,颜色自定义,设置为自己喜欢的就可以: | ||
|
||
```json | ||
"statusBar.background": "#333333", | ||
"statusBar.noFolderBackground": "#333333", | ||
"statusBar.debuggingBackground": "#333333" | ||
``` | ||
|
||
如图所示添加: | ||
|
||
![](../../images/20220516-02-VSCode.png) | ||
|
||
效果图如下: | ||
|
||
![](../../images/20220516-03-VSCode.png) | ||
|
||
不知道怎么修改的可以来试试看,希望可以帮助到你 ☘️ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.