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:
2. Set terminal in pycharm
File—>Settings—>Tools—>Terminal—>Shell path
Change cmd.exe to the path of git just downloaded. Note that sh.exe is selected, not git.exe.
Finally, open Terminal in the lower left corner to run the .sh file.
3. Run the run.sh file
Enter the path where the run.sh file is located
cd 文件所在路径
run command
./run.sh
Notice
① The oblique bar of the path should use /
② ModuleNotFoundError: No module named ‘sklearn’
Solution:
pip install sklean
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.
The terminal interface will appear:
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.
It turns out that the previously installed environment is in tf37. Activate the environment tf37 to run successfully.