Reputation: 3152
I'm new in Python and I have knowledge of R. Due to admin-restriction I can't install packages in folder
C:\Program Files (x86)\Python37-32\Lib
Now, I'm wondering if I can install the package in a folder C:\libPython
and considering this folder when I import the library. So, there are two tasks to carry out:
In R both steps are done by defining the new path:
myLib <- "C:/libR"
.libPaths(myRLib)
install.packages("somewhat", lib=myRLib)
library(somewhat)
I'm using Windows 7 and 10.
Upvotes: 2
Views: 59
Reputation: 2862
To install the package you can use --target
command
pip install --target=C:\Lib package_name
--target dir
Install packages into dir. By default this will not replace existing files/folders in dir. Use –upgrade to replace existing packages in dir with new versions.
And to use the package you can add C:\Lib
to the PYTHONPATH
env variable, this way you tell python that there are packages in a different folder than default
Upvotes: 2