Migrate the Python environment from C drive to other drives

I want to learn to use python for data processing, so I want to build a jupyter notebook environment. But I found that python on my computer was installed in a bottomless directory on the C drive. . So I decided to migrate the Python environment to a specific location! That is, in the E:Environments directory
Insert image description here

1. Copy the python folder into the target folder (easy!)

Find the location of the original python folder and copy the entire python39 to the above directory

Modify environment variables

Replace the python file directory in the path in the previous system environment variable with the new one
Insert image description here

2. Solve the pip problem (medium)

Insert image description here
After looking at it, it seems that pip is not installed in my python at all. fine! Let’s download pip and configure it now,
shall we? ! This is a very stupid question! Because after I type python, I enter the python interpreter. If I type pip or other script instructions here, an error will definitely be reported! ! Here is the Python interpreter! Don't speak another language! THIS IS PYTHON! ! !
Therefore, exit the python interpreter first. The method to exit the python interpreter in cmd is as follows:

  1. Type ctrl+Z and press EnterInsert image description here
  2. Use the function to exit
    (1) exit() and press Enter Oh, turn it on and off just to play
    (2) quit() and press EnterInsert image description here

Now let’s take a look at the pip problem!
Insert image description here
I found that my cmd could not find pip,
but I installed python39! ! ! It must have come with pip! ! So I went to look for the script in python39, and I saw it! There is pip! Then why can't it be found?
This is because! I need to add the script to the path in the system environment variable! Otherwise, how can the system find it? ? ? Recall the role of path for me again!
Insert image description here
Add the script to the path too!
Insert image description here
found it! ! ! Happy and happy! !
Insert image description here
wait? this directory. . . ? ? ? Why am I still changing the previous directory? ! ! ! has a problem! There is a big problem! !
I searched the Internet for the principle of finding packages in python . My current path to the python interpreter is
$path_prefix/python,
but I didn’t understand it very well.
Then I checked where pip. . . Why is it different from pip -V? . .
Insert image description here
I saw someone on the Internet saying that it is because the exe in the script folder will create an absolute path, which will cause pip to be unavailable after the environment is migrated. The
Insert image description here
boss's reply below is
Insert image description here
but I can't understand it! So I don’t dare to use it! !
Finally learned from it! Other people's solutions to pip failure . .
Problem solved!
Insert image description here
Insert image description here

3. The last step! (Fake)

Delete the python environment on the far C drive!
etc? I also installed pycharm! ! ! ! ! !

3. The penultimate step! Configure pycharm!

Still follow this tutorial

4. Delete python on C drive! ! !

Directly select and delete the entire python folder! It was too fast, I didn’t even have time to take a screenshot or even

Cool! ! ! ! ! ! ! ! ! ! ! ! ! ! !

Guess you like

Origin blog.csdn.net/ZHorcrux/article/details/130781162