On a fresh mac OS X(tried both Maverick and Yosemite), I am getting strange results from pythons pip.
I have installed a new version of python in /usr/local/bin/python, and the original version of python still lives at /usr/bin/python. My installation of python is set as the default.
which python
/usr/local/bin/python
When installing my python module, pip installs all the dependencies to /usr/local/bin/python
which is correct. However, it adds the she-bang line of /usr/bin/python
to the console scripts.
Now when I use my console script, I get an import error, because the dependencies don't exist in that version of python.
I can fix this by hand by editing the she-bang line
#!/usr/local/bin/python
and all is fine.
So, here is my question. Why is this happening? Why is pip installing all the dependencies to one version, and using the she-bang from a different version?
More important question, how can I prevent this from happening, so anyone else who installs my module doesn't have to go change this line themselves?
Here is my setup.py:
import sys
from setuptools import setup, find_packages
import foobar
requires = ['pyyaml==3.11',
'six==1.8.0',
'cement==2.4',
'setuptools>=7.0',
'python-dateutil>=2.2',
]
setup_options = dict(
name='foobar',
version=foobar.__version__,
description='Command Line Interface.',
long_description=open('README.rst').read(),
author='Humdinger',
url='example.com',
packages=find_packages('.', exclude=['tests*', 'docs*']),
package_dir={'foobar': 'foobar'},
install_requires=requires,
classifiers=(
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Natural Language :: English',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
),
entry_points={
'console_scripts': [
'foo=foobar.foo:main'
]
}
)
setup(**setup_options)
Upon suggestion, I have added the line
#!/usr/bin/env python
to my setup.py and foo.py file.
This does not seem to solve the problem.
I have also tried to re-try on a fresh mac OSX without installing my own version of python.
$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
$ pip --version
pip 1.5.6 from /Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg (python 2.7)
$ head -1 $(which pip)
#!/usr/bin/python
$ head -1 $(which eb)
#!/usr/bin/python