How to install bpython for Python 3?
Asked Answered
R

1

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.

Routinize answered 18/10, 2016 at 3:36 Comment(0)
L
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
Lading answered 18/10, 2016 at 3:41 Comment(4)
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?Routinize
@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.Lading
The key for me was understanding python3 -m bpythonUteutensil
@Routinize you need to create an alias for bpython, add it to your .bashrc or .bash_aliases file like this: alias bpython='python3 -m bpython'Kettle

© 2022 - 2024 — McMap. All rights reserved.