Description of the problem
I pycharm using anaconda created after the virtual environment, using pycharm terminal to install third-party libraries, but the path has been installed to the disk under the system path, as shown in Figure
According to other blogs to modify the pip install method to modify the file after the path is temporarily modified to the correct, such as Figure
But after pycharm is restarted, the path changes to the C drive again.
In the end, the file was modified successfully, so I'll summarize a few points.
Solution steps and some of the causes of the problem
- The problem we solved this time is the installation path in the virtual environment, so the modification should be the site file in the virtual environment, if the installation is anaconda root environment or python environment, you should go to look for the corresponding site file.
- Regarding the problem of not having permission after modifying the site file, the easiest way is to save the site file as a separate file to the desktop after modifying it, and then paste it again after deleting the folder, which can avoid the problem of not being able to save it, provided that the file is altered correctly.
Screenshots of the operation are given for the above two points
The first step is to check the corresponding path, which should generally be verified before finding this post
python -m site
Then look for the corresponding site file, at this point most tutorials give the following
python -m site --help
This is inaccurate, what you should be looking for is the site file in the environment where pycharm is installed.
give me an example
This is the environment I use
So the site file I'm looking for should be stored in the following path
D:\anaconda3\envs\demo1\Lib
Modify the corresponding statement
Change None to path
Path to the place where you want to install the package, usually the corresponding directory of the current installation environment of pycharm, refer to the above picture to open to the corresponding level, site and base do not install the opposite.
An important point here is thatThe path copied directly from Explorer is problematic
for example
D:\Python38\Lib
Must be changed to double backslash, otherwise the directory can not be recognized, directly reported an error. If you encounter a large red error, you can check the path here whether there is a problem, such as this is not written double backslash caused by the path error
python -m site
After that, save the site file, or save as to the desktop if you have permission problems.
After that, delete the site under Lib, drag the site file on the desktop to solve the problem, if you want to get rid of it once and for all, it is recommended to change the permissions, which will not be explained here.
to this article on how to modify pycharm using anaconda environment after the pip install installation path to this article, more anaconda pip install installation path content please search for my previous posts or continue to browse the following related articles I hope that you will support me in the future more!