Spoiler alert, you cannot activate a venv from a python file.
Through out this post we will discuss on how venv works, why you cannot activate a venv from python.
Let's first go through a code snippet here.
@echo off| #include <math.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #define AT(mat, i, j) mat[((i) * N) + (j)] | |
| struct kpq { | |
| float k; | |
| float p; | |
| float q; |
| const std = @import("std"); | |
| const stdout = std.io.getStdOut().writer(); | |
| const Term = struct { | |
| coef: f32, | |
| exp: i32, | |
| next: ?*Term = null, | |
| }; | |
| const Polynomial = struct { |
| const std = @import("std"); | |
| const stdout = std.io.getStdOut().writer(); | |
| const stdin = std.io.getStdIn().reader(); | |
| const stderr = std.io.getStdErr().writer(); | |
| const expect = std.testing.expect; | |
| const exit = std.os.exit; | |
| const Term = struct { | |
| coef: f32, | |
| exp: i32, |
| def is_valid_state(state): | |
| # check if it is a valid solution | |
| return True | |
| def get_candidates(state): | |
| return [] | |
| def search(state, solutions): | |
| if is_valid_state(state): | |
| solutions.append(state.copy()) |