1

Is it possible to use globally installed packages inside a virtual environment that has a different python version?
The global Python version is 3.9.4, and I have created this virtual environment using virtualenv with Python 3.7.9. The method used is same as the one in this answer.

I have already seen this question where the solution is to make this change in the pyvenv.cfg file.

include-system-site-packages = false        # change this to true

Making this change does not enable usage of globally installed packages. I suspect this has got to do with the paths written in the pyvenv.cfg file:

home = <path to Python 3.7 folder>
implementation = CPython
version_info = 3.7.9.final.0
virtualenv = 20.6.0
include-system-site-packages = true
base-prefix = <path to Python 3.7 folder>
base-exec-prefix = <path to Python 3.7 folder>
base-executable = <path to Python 3.7 executable>

Is it possible to use packages present in the lib folder of the other Python version (that has been globally enabled)? Maybe by changing some paths in the virtual env folder, from where the path to global packages is taken?

muser
  • 155
  • 1
  • 10

0 Answers0