Question
rpgoldman opened this issue · 6 comments
What's the best way to use this with a virtual environment?
You should be good with setting the *python-command*
. At the least, it picks up the libraries from the miniconda base env - I haven't tested it with non-base env.
(setf py4cl:*python-command* "/home/user/miniconda3/bin/python") ; or wherever the python binary is
(python-stop) ; if the previous python process was running
(python-start)
Edit: Corrected pystart
/pystop
to python-start
/python-stop
.
Thanks for replying, sorry for the delay. I have not tried it with virtual environments, but it should be equivalent to running the specified *python-command*
from the command line.
Note in the current "master" and quicklisp version the functions are python-stop
and python-start
Note in the current "master" and quicklisp version the functions are
python-stop
andpython-start
Ah, yes: thanks for the correction!
I've been using mkvirtualenv
, which seems like it's not just a pure python thing -- it also affects the shell environment. So I wonder if just changing the python program is enough, and I also wonder if using straight launch-program
versus launching the shell will be successful.
At least with miniconda, it is enough. Without restarting slime, I get appropriate results for
(progn
(python-stop)
(python-exec "import sys")
(python-eval "sys.path"))
;; try using this to check yours
depending on the value of *python-command*
.
It seems to work nicely with non-base envs too —I'm using it to play around with gym examples and zero issues so far. It's toy usage though, so don't rely too much on this 😅