1、 File Setting Project:xxx Project Interpreter select or add environment
2. The first method sometimes does not solve the problem, and the following problems will occur:
1、 Solution: Edit configurations PythonInterpreter to modify Project Default xxx to a certain python operating environment
Run again at this time to succeed!
Content expansion:
Switch Python operating environment under windows
1、 First make sure that Conda is installed in your system, open a command line window, and execute the command: conda -version
2、 Check the current Python environment of your system and execute the command: conda info -envs. From the figure, we can see that my machine currently only has the default Python environment created when Anaconda is installed. The environment name is root and the corresponding Python version Is 3.7
3、 Now, I want to add a Python2.7 environment, execute the command: conda create -name python27 python=2.7, in the command I set the environment name to be python27, and specify the Python version to be 2.7. After executing the command, Conda will automatically download the latest Version of Python2.7, and automatically deploy
4、 At this point, check the current Python environment of your system again, and execute the command: conda info -envs. From the figure, we can see that there is an additional Python environment named python27.
5、 Check the Python version we are currently using, execute the command: python -version, you can see from the figure that the current Python environment is version 3.7
6、 Switch the Python environment to the newly added Python2.7, execute the command: activate python27, and then execute the command: python –version, to see if the switch is successful, the careful students will find that the command I typed above is executed in git bash, but The switch command is executed in cmd. This is because I found that executing in git bash is useless. I don't know if other students will do it.
7、 In the Python27 environment, after finishing the work, switch back to the original Python environment and execute the command: deactivate python27/ activate base Both are fine
8、 If the Python27 environment you just added is no longer in use, you can delete it by executing the command: conda remove –name python27 –all
Recommended Posts