Liondancer Liondancer - 1 year ago 104
Python Question

pip3.5 install getting variables from else where causing bad interpreter error

I have many versions of

and also

$ pwd

In my
I have:

export PATH=${HOME}/py/python3.5/bin:$PATH

I can run

$ python3.5
Python 3.5.1 (default, Mar 1 2016, 10:49:42)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.

But when I want to run
pip3.5 --no-cache-dir install -U ...
I get:

$ pip3 --no-cache-dir install -U trin-py3-none-any.whl
-bash: /home/bli1/py/python3.5/bin/pip3: /home/sys_bio_ctgcs/sthe-admin/python3.5/bin/python3.5: bad interpreter: No such file or directory

I'm not sure where
comes from. I took this code from someone else so I might've taken other things that I am not aware of.

Answer Source

It seems like you've copied Python binaries from another machine.

Python script endpoints contains shebangs that points to interpreter version which should be used by given script.

You may verify shebang used by pip3.5 those by running cat $(which pip3.5) in shell. If path to binary in first line does not match path to your interpreter, installation is broken. You may possibly fix it by updating all of bash scripts and changing shebang paths in them.

Sample from my machine:

mac-mini:~ rogalski$ cat $(which pip3.5)

# -*- coding: utf-8 -*-
import re
import sys

from pip import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
mac-mini:~ rogalski$ 

#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 should point to valid interpreter. In your case it seems it does not.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download