10

I've been using bpython for Python 2 and now I want to use it for Python 3 as well.

However I've run into problems. The bpython documentation reads:

bpython supports Python 3. It's as simple as running setup.py with Python 3.

When I run the setup script it creates a build folder, but I don't know what to do from there? I want to be able to type bpython in the Terminal and run the bpython interface for Python 3.

I originally installed bpython with pip, that worked off the bat.

rootulp
  • 63
  • 6
timkl
  • 3,299
  • 12
  • 57
  • 71

1 Answers1

21

Run python3 setup.py install command (without install it only builds); You may need to prepend the command with sudo: sudo python3 setup.py install.

BTW, you can also use pip: pip3 install bpython or python3 -m pip install bpython.

And if you pip-install bpython for both 2 and 3, then you can specify which version of Python to use for a given session by using either of the following two commands:

python2 -m bpython
python3 -m bpython
poolie
  • 9,289
  • 1
  • 47
  • 74
falsetru
  • 357,413
  • 63
  • 732
  • 636
  • 1
    Thanks for helping a beginner out! I did manage to install bpython in my "python3.5/site-packages" folder. But how do I set up bpython to enable me to type "bpython" in the Terminal? There is no executable bpython script in the bpython folder that I can alias in my bash profile? – timkl Oct 18 '16 at 16:00
  • 1
    @timkl, If you installed the package using `pip`, issuing the following command will list all the files installed: `pip3 show -f bpython`. `grep` it `pip3 show -f bpython | grep bin` to list executables. Otherwise, check `bin` directories; maybe you need to adjust `PATH` environment variable if the `bin` directory in not listed in the `PATH`. – falsetru Oct 18 '16 at 16:24
  • 2
    The key for me was understanding `python3 -m bpython` – james-see Aug 14 '17 at 13:20
  • @timkl you need to create an alias for bpython, add it to your .bashrc or .bash_aliases file like this: alias bpython='python3 -m bpython' – Rafa Moyano Jun 11 '21 at 18:26