How to use AutoDL to create a virtual environment in pycharm

 1. First, rent an instance. Needless to say,
        please use the cardless mode to configure the environment and debug. The cardless mode is only 0.1¥

2. Connecting with pycharm. I won’t go into details here. There are many tutorials on the Internet.

     

                        Here we still recommend the official tutorial: AutoDL Help Document 

                        Official tutorial of station b: P2_AutoDL platform Pycharm usage tutorial_bilibili_bilibili

3. If we configure various packages directly in the base environment of the instance, the following warning will pop up.

 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behavior with the system package manager. It is recommended to use a virtual environment instead (Running pip as the 'root' user can result in broken permissions and conflicting behavior with the system package manager
. Package manager conflict. Virtual environment recommended)

 So it is recommended to create a virtual environment to configure

  • Mainly talk about how to configure the virtual environment , because the official tutorial does not explain it very clearly.

       The official tutorial directly selects the virtual environment.

But in fact, the conda in our newly created instance has no virtual environment and only a base environment.

So here we need to create a virtual environment by ourselves and then perform the subsequent operations in the tutorial.

  • Friends who have used conda to create a virtual environment should understand

       The main thing is to use instructions:

conda create -n xxx python=3.7 

(This xxx is the name of a virtual environment that you choose yourself) (Write here as many versions of python as you want to install)

I operate it directly using the jupyter terminal of autoDL.

Of course, you can also use the terminal here in pycharm (the official tutorial talks about it)

Then just continue to follow the official tutorial.

Here is also a brief list of common commands for operating the conda environment:

conda info -e                     #查看环境
conda create -n xxx python=3.7    #创建python版本为3.7的新环境xxx
conda remove -n xxx --all         #环境xxx删除
conda env list                    #显示所有的虚拟环境
conda activate                    #默认激活base环境
conda activate xxx                #激活xxx环境
conda deactivate                  #关闭当前环境

Guess you like

Origin blog.csdn.net/djdjdhch/article/details/132893532