How to permanently remove path from python import path

I am using python. I installed the wrong module, and now I want to remove and reinstall it. Since it is erroneous, I cannot use pip uninstallto remove it. Instead, I have to manually remove packages. I was able to remove packages, but the problem arose from the import path. When I delete the package directory, say /home/mypath/directory/, from my PC. Then the import path disappears when I run the commands:

import sys
print sys.path

The printed results do not have this directory. However, when I recreate this directory and run the commands again:

import sys
print sys.path

this directory will appear again. How can I make the system not visit this directory? I know that there is an environment variable PYTHONPATH, but I only know how to add a path using PYTHONPATH, I don’t know how to remove a path. Thanks to everyone for helping me.

+4
source share
1 answer

The path will most likely be obtained from the p-th file in your user-specific package directory.

For me, easy-install.pth contains the packages installed in pip. You can search for this file and edit the infringing directory.

0
source

Source: https://habr.com/ru/post/1671525/


All Articles