Jacob
Jacob

Reputation: 389

How to setup path and env so correct Python used

System A has both Python 2.7 and Python 3.4 installed. System B has both Python 2.7 and Python 3.5 installed.

I have at top of Python script:

#!/usr/bin/env python3.5

The reason being that python3 compiler must be used. I want to move it between machines but this will fail now.

Upvotes: 0

Views: 103

Answers (3)

tale852150
tale852150

Reputation: 1638

If your are set on using #!/usr/bin/env python3.5, you could create a symbolic link to the python3.4 version (called python3.5) and then reference that in your script. So both environments could use the directive #!/usr/bin/env python3.5. Of course, please add a comment somewhere that this is a symbolic link so people are aware of this environment situation.

In fact, I think the python in #!/usr/bin/env python solution is a symbolic link.

Upvotes: 0

Prasad Honavar
Prasad Honavar

Reputation: 117

Use Virtualenv to setup your python environment.

Upvotes: 1

janbrohl
janbrohl

Reputation: 2656

for me just

#!/usr/bin/env python3

works fine

Upvotes: 1

Related Questions