No, a bin directory is not for storing only binary files. It's for keeping executable files, primarily.

Historically, before scripts written in various scripting languages became more common, bin directories would have contained mainly binary (compiled or assembled) non-text files, as opposed to source code. The main thing about the files in bin nowadays is that they are executable.

An executable script is a text file, interpreted by an interpreter. The script in your example is a Python script. When you run it, the python interpreter (which is another executable file somewhere in your $PATH) will be used to run it.

Also, as an aside, a text file is as much a file made up of zeroes and ones as a binary file is.

Answer from Kusalananda on Stack Exchange
🌐
Reddit
reddit.com › r/learnpython › python package: bin folder
r/learnpython on Reddit: Python package: bin folder
March 29, 2018 -

Can someone explain to me what is a purpose of a 'bin' folder in a package?

What kind of script would one put into 'bin' folder and how would that script be different from the main package's module?

Discussions

How to import your package/modules from a script in bin folder in python - Stack Overflow
When organising python project, this structure seems to be a standard way of doing it: myproject\ bin\ myscript mypackage\ __init__.py core.py tests\ __... More on stackoverflow.com
🌐 stackoverflow.com
Shell variable to get Python bin directory? - Stack Overflow
On Mac OS X, when I install a Python package from pip using --user, the binary installs to: /Users/mike/Library/Python/2.7/bin Is there a shell variable I can use to get the location of this direc... More on stackoverflow.com
🌐 stackoverflow.com
terminal - Why isn't a binary not being found in my PATH? - Ask Different
I've got a Python project which uses a virtual environment. In my project folder, there is a bin/ folder which contains all the executables needed by the project. To use these, you run source bin/ More on apple.stackexchange.com
🌐 apple.stackexchange.com
May 19, 2019
How to package a script and have it install to the bin directory?
Problem description I'm able to package modules ok, and have them install. What I can't figure out is how to package an app itself, and have it install in ~/venv/bin so it can be executed a... More on github.com
🌐 github.com
4
August 13, 2021
Top answer
1 of 2
22

I just recently got through Ex46 in LPTHW myself. Like you, I was confused by the scripts. In case the other answer was too advanced for you, I ended up just putting in a simple "hello world" script:

#!/usr/bin/env python

from test3 import printstring
printstring.printstring("test script working")
print "test over"

I named that file testscript3.py (*Note, I learned later that it would be more convenient to leave off the .py filename extension if it were a real script that I wanted to seem like a system command)

My file test3.py was like so:

def printstring(s='you did not provide string'):
    print s

Here's some newbie things that I learned while trying to get this process to work:

  • The #! symbol is sometimes pronounced shebang and the simple explanation is that the command on that line tells the shell to use python to run the script. If you leave off the ".py" filename extension, then the user of the script doesn't need to care what interpreter is needed to run the script. See wikipedia shebang article.

  • I ran the following command to package the distribution:

    python setup.py sdist

  • After doing that, I was able to install the package and script by running

    sudo pip install test3-0.1.tar.gz

  • One thing I worried about was permissions on the script file. However, I noticed that distutils took care of this when packaging (changed mode to 755 or whatever).

You can find my whole project for this example on github.

2 of 2
3

For example Django's project creating, Scrapy's project creating, django-admin.py and scrapy are both scripts in bin folder.

You could get even more examples by checking almost python-based tools.

🌐
YouTube
youtube.com › codewarp
where is python bin folder - YouTube
Download this code from https://codegive.com The Python bin folder typically contains the Python executable files. The location of this folder can vary depen...
Published: December 26, 2023
Views: 222
🌐
Stack Overflow
stackoverflow.com › questions › 36019734 › shell-variable-to-get-python-bin-directory
Shell variable to get Python bin directory? - Stack Overflow
On Mac OS X, when I install a Python package from pip using --user, the binary installs to: /Users/mike/Library/Python/2.7/bin Is there a shell variable I can use to get the location of this direc...
🌐
Real Python
realpython.com › add-python-to-path
How to Add Python to PATH – Real Python
July 23, 2026 - But if Python is already in the /bin/ folder, then it’s most likely already on PATH because /bin/ is automatically added by the system.
Find elsewhere
🌐
Python
docs.python.org › 3 › using › windows.html
4. Using Python on Windows — Python 3.14.8 documentation
This is optional, if you prefer to use the py command, but is offered for those who prefer the full range of aliases (such as python3.14.exe) to be available. The directory will be %LocalAppData%\Python\bin by default, but may be customized ...
🌐
GitHub
github.com › pypa › packaging-problems › issues › 537
How to package a script and have it install to the bin directory? · Issue #537 · pypa/packaging-problems
August 13, 2021 - Problem description I'm able to package modules ok, and have them install. What I can't figure out is how to package an app itself, and have it install in ~/venv/bin so it can be executed as a command. The app is a Python script and woul...
Author: pypa
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › beginners
Add user's BIN directory to path so it is searched for commands - Raspberry Pi Forums
I have an executable Python script which works fine if I put it in my home/myusername directory and execute it with ./pythonfilename (I have made the file executable by my username, and it has the appropriate first line identifying it as an executable Python file). if I follow advice to create a /bin folder in home/myusername, put the executable python script there and exit / re-enter the terminal, what I have found on the net so far suggests that Rasbian should automatically add my /home/myusername/bin directory to the path it searches for executables.
🌐
Netlify
main--dasarpai.netlify.app › dsblog › python-project-folders-and-files
Python Project Folders and Files ·
May 25, 2026 - The Scripts/bin folder in .venv is for managing the Python interpreter and the executables that come with third-party packages installed in the environment.
🌐
Code with Mosh
forum.codewithmosh.com › python
Missing bin folder in venv - Python - Code with Mosh Forum
June 25, 2023 - The Ultimate Django Series: Part 1, lesson 6 (Using the Integrated Terminal in VS Code) in Django fundamentals: When I enter python interpreter path (C:\Users\Korisnik.virtualenvs\storefront-Tnn4kiNM\bin\python), I get …
🌐
Python.org
discuss.python.org › python help
Putting python directory in the path - Python Help - Discussions on Python.org
October 9, 2022 - I added this to .bashrc so I can run pythons scripts from any dir. export PATH="/home/andy/Python/:$PATH" echo $PATH /home/andy/Python/:/home/andy/.local/bin:/home/andy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr…
🌐
dasarpAI
dasarpai.com › data science blog › python project folders and files
Python Project Structure: Folders, __init__.py & Best Practices · dasarpAI
September 26, 2024 - The Scripts/bin folder in .venv is for managing the Python interpreter and the executables that come with third-party packages installed in the environment.
🌐
ROS Answers
answers.ros.org › question › 396904 › bug-python-nodes-installed-in-bin-folder
Bug? Python nodes installed in bin folder - ROS Answers: Open Source Q&A Forum
March 1, 2022 - I am building ros2 foxy from source on a fully patched xubuntu 20.04.4 system on an x86 platform. It installs fine without critical errors. However, python nodes are installed in $packetname/bin instead of $packetname/lib/$packetname. I can not figure out why.