Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

How to change default install location for pip

'''Assuming pip installs the packages in the wrong site-packages path but -
you want pip to intall the package under conda base path (any conda 
environment). And also assuming you using IDE liker spyder or pycharm or
jupytor etc., running under conda site-packages path (correct path)'''
# Then run the following code inside the IDE runing under conda.
from distutils.sysconfig import get_python_lib
print(get_python_lib())
# The output should be site-package path, such as:
/home/user/.pyenv/versions/3.8.9/lib/python3.8/site-packages
#To make pip install packages to this path by default,-
#Then in the terminal use the output site-package path as follows:
pip config set global.target /home/user/.pyenv/versions/3.8.9/lib/python3.8/site-packages
#After this pip should install all packages to this path by default. 
 
PREVIOUS NEXT
Tagged: #How #change #default #install #location #pip
ADD COMMENT
Topic
Name
1+8 =