So classic beginner problem here... Ive been trying to use Python on various text editors like VSCode and Atom and none of them seem to work (After installing python 3.7). If I ask for a simple input the program crashes labelling the input as undefined, but when I use raw_input() it works just fine for some reason. However, raw_input() was changed to input() in Python 3 so why does this keep happening to me?
问题:
回答1:
You need to be using virtual environments. Since you're running on a Mac I would suggest you use the Anaconda distribution of Python. Instructions are here. This simplifies the process of making virtual environments. It's as easy as conda create -n myenv python=3.6
and more detailed instructions are found here. Once conda is installed you can use commands like conda install scipy
to install python packages. Once you have virtual environments installed and activated your command should work. Try it in the python 3.6 environment.
回答2:
Strange,
I guess something wrong with installation,
Please check what:
import sys
print(sys.version)
Outputs,
and also see what this outputs:
import platform
print(platform.python_version())
And see if this works:
print 'hello'
If it does work, you're on python 2, also see what sys.version
and platform.python_version()
outputs
回答3:
As U9-Forward has mentioned in his answer, similarly...
Check that the installtion of Python 3.7 is correct by entering the follwoing into the Python 3.7 native IDLE Shell (you may have been using the IDLE of an older Python version):
import sys
print(sys.version)
and...import platform
print(platform.python_version())
If any of this produces an error, you will know if there was a problem with installation.
It's possible that you have multiple versions of Python installed. Check to see what versions you do have installed. If you have other versions besides Python 3.7 uninstall them.
If the problem persists uninstall Python 3.7 and reinstall it.
The problem as you described can occur when one attempt to install a newer version of Python when older version(s) are still installed.