Running bpython inside a virtualenv
Run bpython as module works for me
mkdir workout && cd workout
venv shell --python=3.8
- Install your dependencies, e.g.,
pipenv install gcloud
pipenv install bpython
python -m bpython
python -m bpython
bpython version 0.21 on top of Python 3.8.5 /home/dennys/.local/share/virtualenvs/workout-qTtsVfjR/bin/python
>>> from gcloud import bigquery
>>>
bpython
must be installed in the virtualenv, otherwise the external, system-wide bpython is called:
$ source alchemy/bin/activate
(alchemy)[ 10:34PM ] [ adamatan@rubidium:/tmp ]
$ pip install bpython
...
$ alchemy/bin/bpython
--------------
>>> import sqlalchemy
>>> print sqlalchemy.__version__
0.9.7
bpython
has the python it was installed with hardcoded in its shebang.
You can manually edit it to make it use the current python. Open the script by running for instance $ vi $(which bpython)
.
Then change the top line from eg. #!/usr/bin/python3
to eg. #!/usr/bin/env python3
.
That should make it run using the venv's python. It's not supported officially by bpython but it has always worked for me on both Mac OS X and Ubuntu.
Bpython must be installed with pip3 inside each virtualenv
$ virtualenv .
$ source bin/activate
$ pip3 install bpython
$ pip3 install sqlalchemy
$ bpython
>>> import slqalchemy