current position:Home>[Bi She] Style Migration Based on CycleGAN [3] Code Migration to Server (Linux) and Environment Construction

[Bi She] Style Migration Based on CycleGAN [3] Code Migration to Server (Linux) and Environment Construction

2023-01-25 10:55:10Mr Roose

1. Assume that anaconda has been installed on the server.

2. Copy the code file (file name pytorch-CycleGAN-and-pix2pix-master) to the Desktop (desktop) via the U disk

3. Open Terminal, you will directly enter the anaconda terminal.

Anaconda operation under Linux (similar to windows)

See which environments currently exist

conda env list

Create a new virtual environment.

conda create -n your_env_name python=X.X (2.7, 3.6, etc.)

Activate the virtual environment.Before you can use the environment, it needs to be activated.

source activate your_env_name

Install various required python packages.

pip install package_name

(If you create a python3.x environment, use pip directly instead of pip3. Because pip3 may be installed directly into your system environment at this time.)

Close the virtual environment.When you are done using it, you need to close the virtual environment.

source deactivate

Delete the virtual environment.

conda remove -n your_env_name --all

Shared environment: Package the name of the python package contained in the currently used environment.

conda env export > filename.yaml

Load an environment shared by others.

conda env update -f=/path/filename.yml

4. Create a new environment called cyclegan: conda create -n cyclegan python=3.6

5. Activate (enter) the cyclegan environment: source activate cyclegan

6. Because we want to copy the environment directly with the txt file provided by the author, we need the cd path to the code file you just copied to the Desktop (desktop): cd /home/dell/Desktop/pytorch-CycleGAN-and-pix2pix-master/

(Novices may have a question, why is there a dell file in the middle when Desktop is the home file?

Explanation:

Questions

There is an aaa folder under the home folder. Why can't I choose the aaa folder?

Solution

As it says, because there is no such directory.Terms such as "home directory", "home directory", "home folder" and "user directory" refer to the directory represented by ~, which is the main directory assigned to this user.For normal users, usually it is located at "/home/username".What you said should be ~/aaa, which means /home/test/aaa when expanded.Remember to use ls to view directory contents.)

7. Under normal circumstances, we can directly use pip install -r requirements.txt (requirements.txt is the environment package packaged by the author) to reproduce the environment, but the speed is too slow.So we use the mirror source to fork the environment.

Domestic source:

Tsinghua: https://pypi.tuna.tsinghua.edu.cn/simple

Aliyun: http://mirrors.aliyun.com/pypi/simple/

University of Science and Technology of China https://pypi.mirrors.ustc.edu.cn/simple/

Huazhong University of Science and Technology: http://pypi.hustunique.com/

Shandong University of Technology: http://pypi.sdutlinux.org/

Douban: http://pypi.douban.com/simple/

Example of use:

You can add parameter -i when using pip https://pypi.tuna.tsinghua.edu.cn/simple

For example: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider, so that the pyspider library will be installed from the Tsinghua mirror.

Continued 7. We can reproduce the environment by typing pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt.

There is another way to fork the environment:

We can directly copy the environment in pycharm, first create a virtual environment in Terminal, and then according to (5 messages) How to configure the existing environment in Pycharm_MrRoose1's blog-CSDN blog_pycharmHow to configure the environment After configuring the environment and selecting that environment, then directly perform pip install -r requirements.txt in the Terminal in pycharm (depending on whether the name in the front brackets in the Terminal is the environment you want to enterfirst name)

copyright notice
author[Mr Roose],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2023/025/202301251029560074.html

Random recommended