Consider the following setup.py
file (for the example the only other source file (false.c
) is generated right here):
#!/usr/bin/env python
from setuptools import setup
from distutils.ccompiler import new_compiler
from subprocess import check_call
with open('false.c', 'w') as F:
F.write('int main(int argc, char **argv){ return 1; }\n')
compiler = new_compiler().compiler
check_call(compiler + ['-O3', 'false.c', '-o', 'false'])
setup(
name='false',
scripts=['false'],
)
. This file works fine when using python-2* (when using pip install -e .
while in a directory with this setup.py
file) installing compiled false
executable to $VIRTUAL_ENV/bin
. But if I use virtual environment with python-3* it fails with the following error: (full error log)
<...>
File "/home/zyx/.virtenvs/python3.2/lib/python3.2/site-packages/distribute-0.6.28-py3.2.egg/setuptools/command/develop.py", line 27, in run
self.install_for_development()
File "/home/zyx/.virtenvs/python3.2/lib/python3.2/site-packages/distribute-0.6.28-py3.2.egg/setuptools/command/develop.py", line 105, in install_for_development
self.process_distribution(None, self.dist, not self.no_deps)
File "/home/zyx/.virtenvs/python3.2/lib/python3.2/site-packages/distribute-0.6.28-py3.2.egg/setuptools/command/easy_install.py", line 659, in process_distribution
self.install_egg_scripts(dist)
File "/home/zyx/.virtenvs/python3.2/lib/python3.2/site-packages/distribute-0.6.28-py3.2.egg/setuptools/command/develop.py", line 138, in install_egg_scripts
script_text = f.read()
File "/home/zyx/.virtenvs/python3.2/lib64/python3.2/codecs.py", line 300, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 208: invalid start byte
<...>
data_files=[('bin', ['false'])]
. But this is not going to work withpip install -e
, onlypip install
without-e
. – ZyX Nov 19 '13 at 20:57