Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3611214
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:50:57+00:00 2026-05-18T21:50:57+00:00

I have a Python package that includes a few scripts in a scripts/ folder.

  • 0

I have a Python package that includes a few scripts in a scripts/ folder. My setup.py file includes::

#!/usr/bin/env python

from distutils.core import setup

scripts = ['script1', 'script2', 'script3']

setup(name='Test',
      version='0.1.0',
      packages=['test'],
      scripts=['scripts/' + x for x in scripts]
     )

Each script contains the line::

#!/usr/bin/env python

at the top. However, when I run python setup.py install this line gets changed to::

#!/usr/bin/python

automatically in the installed scripts. Is there a way to avoid this? The reason that this is a problem for me is because I am using virtualenv, and so the correct path for the Python executable should be::

#/Users/user/.virtualenvs/default/bin/python

so I’d rather it left the interpreter set to::

#!/usr/bin/env python

Thanks for any advice!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:50:57+00:00Added an answer on May 18, 2026 at 9:50 pm

    The install scripts checks, where the python is installed and changes this python to the proper one. It does it on every machine, where your package is installed.

    From docs:

    Scripts are files containing Python
    source code, intended to be started
    from the command line. Scripts don’t
    require Distutils to do anything very
    complicated. The only clever feature
    is that if the first line of the
    script starts with #! and contains the
    word “python”, the Distutils will
    adjust the first line to refer to the
    current interpreter location. By
    default, it is replaced with the
    current interpreter location. The
    –executable (or -e) option will allow the interpreter path to be
    explicitly overridden.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a Python package, I have a string containing (presumably) the name of a
I have installed pylons based application from egg, so it sits somewhere under /usr/lib/python2.5/site-packages.
Is it possible to have Python save the .pyc files to a separate folder
I have Python 2.6 and I want to install easy _ install module. The
If I have Python code class A(): pass class B(): pass class C(A, B):
If I wanted to have Python distributed across multiple processors on multiple computers, what
Does Python have a unit testing framework compatible with the standard xUnit style of
Does python have the ability to create dynamic keywords? For example: qset.filter(min_price__usd__range=(min_price, max_price)) I
Does Python have extension methods like C#? Is it possible to call a method
I have a Python module installed on my system and I'd like to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.