Python 2 compatible with Python 3

Hello,

I am needing help with writing a code that will make my task that was built in python 3 compatible with python version 2. The computer the task will be run on only has python 2 and can not be changed to python 3.

I am unfamiliar with future would you be able to explain how that works?

I’m sorry. I misread the question. The future module helps you to use py3 functionality in py2, but it doesn’t convert your code.

You may be interested in:
https://wiki.python.org/moin/3to2

Is there a line of code that I can put before my task starts in order to make it compatible with version 3?

Not that I know of.

On this site there is advice on how to convert scripts from py3 to py2:

"Do you know how to use pip?

Just type in C:/[Enter your python folder]/Scripts/pip install 3to2

Go to the Scripts folder in the Python folder and rename 3to2 to 3to2.py

Then, type in C:/[Enter python folder again]/python.exe C:/[Enter python folder]/Scripts/3to2.py -w Path/To/The/Python/File"

I do not know how to use pip

This is what I am typing into the python command window and it comes back invalid. I have tried other variations of this code too, but it is not working.

C:/[Users\EEG\Python]/Scripts/pip install 3to2

The python folder is just the pathway right?

Can you not just install the standalone version of PsychoPy (version 3 if you like), and ignore the issue of what Python version is installed on the computer? i.e. standalone PsychoPy has its own bundled version of Python, precisely so you don’t have to worry about things like this.