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
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
2. Solve the pip problem (medium)
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:
- Type ctrl+Z and press Enter
- Use the function to exit
(1) exit() and press Enter
(2) quit() and press Enter
Now let’s take a look at the pip problem!
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!
Add the script to the path too!
found it! ! ! Happy and happy! !
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? . .
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
boss's reply below is
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!
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! ! ! ! ! ! ! ! ! ! ! ! ! ! !