Implement pycharm to run .sh files - run locally and open server terminals

.sh scripts can automatically run multiple experiments.

Realize pycharm running .sh file under Windows system

1. Install Git

Download from Git official website
and install with default settings.
Right-click on the desktop and options such as Git GUI Here appear, indicating that the installation is successful:
insert image description here

2. Set terminal in pycharm

File—>Settings—>Tools—>Terminal—>Shell path
insert image description here
Change cmd.exe to the path of git just downloaded. Note that sh.exe is selected, not git.exe.
insert image description here
Finally, open Terminal in the lower left corner to run the .sh file.
insert image description here

3. Run the run.sh file

Enter the path where the run.sh file is located

cd 文件所在路径

run command

./run.sh

insert image description here

Notice

① The oblique bar of the path should use /

② ModuleNotFoundError: No module named ‘sklearn’

Solution:
pip install sklean

insert image description here
The installation failed because of network speed problems, so use the Douban mirror source to install:

pip install sklearn -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

Open terminal of remote server in pycharm

What I said earlier is to use pycharm to run run.sh on the local Windows computer.
If pycharm has connected to the Linux server, Git is not required to open the server terminal in pycharm.
Opening the terminal of the server can directly perform command line operations on the remote server in pycharm, which is very convenient.

1. Select Tool—>Start SSH session, and select the connected server.

insert image description here
The terminal interface will appear:insert image description here

2. Run the run.sh file

Enter the path where the file is located

cd 路径

Run the run.sh file

./run.sh

An error occurred.
insert image description here
It turns out that the previously installed environment is in tf37. Activate the environment tf37 to run successfully.
insert image description here

Guess you like

Origin blog.csdn.net/qq_45484237/article/details/124019158