[Create configuration environment]
1. Create and configure the environment
The xx below is your own environment name
conda create -n xx python==3.9
conda activate xx
报错1:CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
source activate
//conda deactivate //回到base环境
conda activate xxx
Just choose one of the two PyTorch (enter the environment first and then configure)
pip install torch torchvision torchaudio
Torch has entered the 2.0 era, and I need to choose the version I need: Previous PyTorch Versions | PyTorch
pip install torch==1.13.0+cu116 torchvision==0.14.0+cu116 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu116
Set up Tsinghua mirror source and permanent configuration
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
2. Check whether pytorch is installed successfully
Under base, check what user environments there are now (do you have your own) refer
conda env list
Enter your own environment and see if torch/torchvision is successfully installed.
conda list
If the installation is not successful, you can return to the first step to reinstall↑; if you want to remove it, recreate it or rename it↓ (check it in env after the completion)
conda remove -n xxx --all
Other commands:
Check python version
python -V
View video memory usage: parameters
nvidia-smi
3. Open the project, set the creation environment, and run the program to install the required packages.
(You can debug the CPU first to solve various basic running problems; remember to switch the compilation environment when running the server, not the CPU)
(You can adjust the batchsize and epoch to be smaller to run through first, and install pip install xxx according to the no module problem encountered)
Frequently encountered/special ones:
cv2
pip install opencv-python
tensorboard
pip install tb-nightly
skimage
pip install scikit-image
No module named 'yaml' (add a py in front)
pip install pyyaml
other:
pip update
python -m pip install --upgrade pip
According to requirement.txt, all pip install xxx does not need to be specific to the version or directly
pip install -r requirements.txt
Kill unused but occupied processes
kill -9 xxx
rar installation and use , if the make permission is not enough to enter root ( first two steps )
[jupyter and other commands]
1. Jupyter enters drive E
conda activate
cd /d E:
jupyter notebook
2. View the folder tree directory: first cd \d directory; then tree
cd /d F:\0-MINE-coding\yolo
tree
# 查看三级目录
tree -L 3
If there is no tree, install it first, multiple tree structure display methods
sudo apt-get install tree
3. Command to delete files
MobaX returns two levels first
Enter the correct directory! Enter the correct directory!! Enter the correct directory!!! Tag can be used
cd /mnt/2TB/zj
rm -rf xxxx
4. Return to directory (cd space)
返回上一级目录 cd ..
返回上两级目录 cd ../..
返回home目录 cd或cd ~
返回指定目录 cd - 目录名
5. Use bash to download gitee/github: git clone [url]
[Common Linux commands]
Pack all files and folders in the /home/html/ directory into html.zip in the current directory:
zip -q -r html.zip /home/html
If we are in the /home/html directory, we can execute the following command:
zip -q -r html.zip *
【Coding tools】
1. Download from github: Use the git tool, right-click, and paste the Link after the following command
git clone
2. Data enhancement albumations
3、
[pycharm shortcut keys]
- Collapse all code: Ctrl + Shift + - (minus sign)
- Expand all code: Ctrl + Shift + + (plus sign)
[Pycharm remote settings]
I have been transferring files between different computers orz and the desktop remote orz is stuck and there is no visual MobaXterm. I surrender.
The important thing to note is that every time you change the code locally, remember to uploaduploadupload
First install Pycharm professional and interpreter to set up the connection.
Fill in your python environment (that is, your python address): If it is an Anconada environment, the address is generally "/home/your usr name/.conda/envs/envs name/bin/python"
Set the file location on the remote server, which is the image of the local project. Set it up so there's no confusion. It is also convenient to run experiments directly with MobaXterm in the future. (Can be ignored)
You can also set file directory mapping in tools
Then select the interpreter you configured. Done.
Attention!!! After completing the local changes, remember to deploy and upload
【else】
1. Environment display PS:
2. ModuleNotFoundError: No module named 'xxx' appears after connecting to the server. It needs to be configured on the server!! It is invalid locally.
3. " The environment location directory is not empty ": The solution is to manually delete the venv folder under the project, restart Pycharm, and then configure New environment.
4. CondaHTTPError: HTTP 000 CONNECTION FAILED for url problem occurs in Anaconda