I want to install virtual env in a specified directory and install some packages inside that with a Python script.
It's my script but it can't activate the virtual env, it say that the package is already install globally.
this script is just for testing and it should be incomplete.
import os
import sys
requierments = ['xerox', 'sqlparse']
dest, env_name = sys.argv[1], sys.argv[2]
if dest == './':
os.system(f'python3 -m virtualenv {env_name}')
elif dest[:2] == './':
dest = dest.replace('.', os.getcwd())
else:
os.system(f'python3 -m virtualenv {dest} {env_name}')
os.chdir(f'{dest}/{env_name}')
print(os.getcwd())
os.system('source ./bin/activate')
for req in requierments:
os.system(f'python3 -m pip install {req} --user')
print('\n\n***FINISHED***')