Wednesday, February 2, 2022

[SOLVED] how to install python packages in "site-packages"?

Issue

I made Virt2 virtual environment.
using $ python -m venv Virt2.

I want to install my custom packages in "site-packages" directory. However packages are installed in "dist-packages" directory.

enter image description here

what should I do to install packages in my python virtual environment site-packages??


my python version 3.6.2 (in /usr/local/bin)


Solution

You use sudo and sudo switches user to root, i.e. you're completely outside of you virtual env. System pip3 outside of virtual env installs packages into a system directory which is dist-packages.

Run pip install inside you virtual env without sudo.



Answered By - phd
Answer Checked By - Katrina (WPSolving Volunteer)