Reputation: 99
I installed Python 2.7 a long time ago on my PC (I am running Windows 10). Today I decided to install Python 3.7, but after typing 'python' into the command prompt the console printed 'python 2.7...'
I have no idea as to what I should do. Would this be a problem with my path configuration? I considered uninstalling python 2.7 but I still want it installed on my computer.
Upvotes: 4
Views: 9802
Reputation: 360
You Can Configure The Python2 & python3 In Windows PC Like This:
After Installing Both Packages Go To Their Respective Folders And Copy python.exe & Paste In The Same Directory and rename the python - Copy with python2(In python27 folder) & python3(In python39 folder)
And Then Set Environment Vairable Like This:
All Done Now You Can Run Any Script Which May Compatible With Python2 or Python3 :)
Upvotes: 1
Reputation: 1
I would suggest to use virtual environment. Soon or later you would you might get dependency problems.
Upvotes: 0
Reputation: 24114
Python 3.3 introduced the Python Launcher for Windows. Rather than using python.exe
, call py
and select the version with flags:
py -2.7
py -3
System-wide installations of Python 3.3 and later will put the launcher on your PATH.
If the launcher is run with no explicit Python version specification, and a virtual environment (created with the standard library venv module or the external virtualenv tool) active, the launcher will run the virtual environment’s interpreter rather than the global one. To run the global interpreter, either deactivate the virtual environment, or explicitly specify the global Python version.
python.exe
to python27.exe
and rename Python 3.7 from python.exe
to python37.exe
. Then on the command line, select the version by entering python27
or python37
. Whichever version is preferred, could be left as just python
. C:\Python27
C:\Python27\Scripts
C:\Python37
C:\Python37\Scripts
This will enable Python and pip. Be sure that paths match your actual installation directories.
Upvotes: 8
Reputation: 5451
I would suggest using pyenv
I have been using it and is working well for me. Some of the handy features of pyenv are
Upvotes: 1