0

I have my script written in python3, but when I share the script with other users and the user has python2 environment my script won't run. Is there a way to make my py3 script run regardless of what python environment the user has? is there a way to unset their current python and set to python3(assuming I know the py3 location)?.

If I have a bash wrapper, I can export both PYTHON and PYTHONPATH variables but not sure how to do this in python. Thanks.

4
  • 3
    Make a standalone executable from the Python script so you don't need them to have anything. Commented Oct 10, 2018 at 16:24
  • 1
    I think people will be pretty unhappy with you if you start changing their path just to run your script. Commented Oct 10, 2018 at 16:34
  • Possible duplicate of Python 2 and Python 3 dual development Commented Oct 10, 2018 at 16:36
  • This sounds like a job for virtual environments (often with virtualenv or pipenv), which are a/the sane way to handle sandboxing Python. If you can't give them a shell script to run, though, you may be out of luck; without more details on your target users and your requirements, we can't really tell. Commented Oct 11, 2018 at 5:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.