0

When I run python venv:

python -m venv test-env
. test-env/bin/activate

I have virtual environment with pip avaliable (although it's not avaliable for my outside the venv. However, in this environment all packages need to be installed, which are already avaliable globally. I learned I have to set venv with --system-site-packages flag. But when I do this:

python -m venv --system-site-packages test-env
. test-env/bin/activate

I can't use pip inside the virtual environment, so it's pointless, because I can't install any additional packages. How to solve this problem?

1 Answers1

0

I can't use pip inside the virtual environment, so it's pointless, because I can't install any additional packages. How to solve this problem?

A bit to early to give up on pip! You can add any package you want in the new environment, eg:

pip install pandas

Looks like you are unsure about a list of your dependencies. They are normally stored in a file called requirements.txt, which is specific to a project. For example, a github repository ususally has requirements.txt - so that users can replicate the dependcies.

You can create requirements.txt manually, or use pip freeze after you have installed the packages you want one by one. A bit more here.

Also recommended to look at pipenv, which combines virtualenv and pip functionality under one roof.

Dodge
  • 3,219
  • 3
  • 19
  • 38
Evgeny
  • 4,173
  • 2
  • 19
  • 39