Is there a way to activate a Python virtual environment in Eshell? When
I try `source ./.venv/bin/activate`, I get "Wrong type argument: listp,
"["". Obviously, this is because `source` is built into the shell
(bash, csh, fish, eshell, etc.) and the default activate is for bash.
So, I guess the real question is if there is already a script to
activate the venv in eshell? Or some other way to do it?
Rust Buckett <rsstinnett@pm.me> writes:
Is there a way to activate a Python virtual environment in Eshell? When
I try `source ./.venv/bin/activate`, I get "Wrong type argument: listp,
"["". Obviously, this is because `source` is built into the shell
(bash, csh, fish, eshell, etc.) and the default activate is for bash.
So, I guess the real question is if there is already a script to
activate the venv in eshell? Or some other way to do it?
If you read "./.venv/bin/activate", you'll see that what it do mostly is setting VIRTUAL_ENV to "./venv" and add "$VIRTUAL_ENV/bin" to your PATH
to access the "correct" python.
So doing the following should work:
export VIRTUAL_ENV="/absolute/path/to/venv"
export PATH="$VIRTUAL_ENV/bin":$PATH
But maybe you could come up with an elisp function to more easily
activate (and deactivate) those.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 54 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 17:34:52 |
| Calls: | 742 |
| Files: | 1,218 |
| D/L today: |
4 files (8,203K bytes) |
| Messages: | 184,412 |
| Posted today: | 1 |