After installing a package in an anaconda environment, I'll like to make some changes to the code in that package.
Where can I find the site-packages
directory containing the installed packages? I do not find a directory /Users/username/anaconda/lib/python2.7/site-packages
This question is related to
python
python-2.7
pip
anaconda
You could also type 'conda list' in a command line. This will print out the installed modules with the version numbers. The path within your file structure will be printed at the top of this list.
I encountered this issue in my conda environment. The reason is that packages have been installed into two different folders, only one of which is recognised by the Python executable.
~/anaconda2/envs/[my_env]/site-packages ~/anaconda2/envs/[my_env]/lib/python2.7/site-packages
A proved solution is to add both folders to python path, using the following steps in command line (Please replace [my_env] with your own environment):
To ensure this works, try to activate Python in this environment, and import the package that was not found.
Linux users can find the locations of all the installed packages like this:
pip list | xargs -exec pip show
You should find installed packages in :
anaconda's directory / lib / site_packages
That's where i found mine.
I installed miniconda and found all the installed packages in /miniconda3/pkgs
Run this inside python shell:
from distutils.sysconfig import get_python_lib
print(get_python_lib())
At least with Miniconda (I assume it's the same for Anaconda), within the environment folder, the packages are installed in a folder called \conda-meta.
i.e.
C:\Users\username\Miniconda3\envs\environmentname\conda-meta
If you install on the base environment, the location is:
C:\Users\username\Miniconda3\pkgs
Source: Stackoverflow.com