fix: work with pip in venv

pull/158/head
json1c 2025-06-23 22:44:16 +03:00
parent 4dbe2aec94
commit d962def6f0
1 changed files with 6 additions and 3 deletions

View File

@ -15,9 +15,9 @@
import ast
import asyncio
import contextlib
import difflib
import functools
import importlib
import difflib
import inspect
import io
import logging
@ -33,10 +33,10 @@ from importlib.machinery import ModuleSpec
from urllib.parse import urlparse
import requests
from herokutl.errors.common import ScamDetectionError
from herokutl.errors.rpcerrorlist import MediaCaptionTooLongError
from herokutl.tl.functions.channels import JoinChannelRequest
from herokutl.tl.types import Channel, Message, PeerUser
from herokutl.errors.common import ScamDetectionError
from .. import loader, main, utils
from .._local_storage import RemoteStorage
@ -662,6 +662,9 @@ class LoaderMod(loader.Module):
),
)
is_venv = hasattr(sys, 'real_prefix') or sys.prefix != getattr(sys, 'base_prefix', sys.prefix)
need_user_flag = loader.USER_INSTALL and not is_venv
pip = await asyncio.create_subprocess_exec(
sys.executable,
"-m",
@ -671,7 +674,7 @@ class LoaderMod(loader.Module):
"-q",
"--disable-pip-version-check",
"--no-warn-script-location",
*["--user"] if loader.USER_INSTALL else [],
*["--user"] if need_user_flag else [],
*requirements,
)