Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More accurate guidance: what is the meaning of "you're in your virtual environment" ? #741

Open
gezamolnar opened this issue Jun 15, 2020 · 1 comment

Comments

@gezamolnar
Copy link

gezamolnar commented Jun 15, 2020

Hi,

As a newbie, I would like to read more accurate descriptions.
e.g.
"Installing packages
Now that you're in your virtual environment you can install packages. Let's install the Requests library from the :term:Python Package Index (PyPI):
"

  • Does this mean that
    a) the command shell's current directory needs to be set to the virtual environment's directory (if yes: exactly which directory?)
    or
    b) the meaning is that kind of I've been logged in to this virtual environment (and doesn't matter where the current directory is, even it can be changed to any other virtual environment's directory) and the commands are served/ran by the bins in the activated virtual environment?

n.b. 'logged in' is quite an abstract phrase here - meaning something like locked, bound, activated - still learning the phrases :-)
---edit---
I found this
https://docs.python.org/3/library/venv.html#module-venv
"You don’t specifically need to activate an environment; activation just prepends the virtual environment’s binary directory to your path, so that “python” invokes the virtual environment’s Python interpreter and you can run installed scripts without having to use their full path. However, all scripts installed in a virtual environment should be runnable without activating it, and run with the virtual environment’s Python automatically.
"

  • So, an activated virtual environment is not something like logged in, as far as I understand actually it's something very weak, it's a temporal change of PATH (until deactivate is run)

Also, a description (diagram, maybe) of the process/flow of activating-using-deactivating virtual environments would shed light here, e.g. what is changed under the hood, what variables are affected, how a command and its path is interpreted. Maybe that belongs to another topic.

Thanks!

@merwok
Copy link
Contributor

merwok commented Jun 19, 2020

It does indeed refer to being in a shell with the virtual environment active.
The directory where you are is not relevant; Python install tools do not put things in the current directory (like npm or others) for now, but always into a site-packages directory (system, virtualenv or user-specific).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@merwok @gezamolnar and others