2

I think my title is pretty self-explanatory.

I want to uninstall Python 2.7 and keep Python 3.4 intact. Is this easy to do? I found a couple of tutorials about how to uninstall Python, but I don't want to uninstall the entire thing. Also, I am running Spyder (Python 3.6). This should work just fine after I get rid of 2.7, right. The reason I am asking all of this is because I installed pandas_datareader and apparently it went to 2.7, but I really wanted it on 3.4. Finally, I'm assuming, after I unistall 2.7, and run this 'pip install pandas_datareader' it will go to 3.4, right.

I can't seem to control where the install goes.

enter image description here

enter image description here

2 Answers 2

1

Instead of using:

pip install <module>

you can use the following to install the module which will install it to python-3.x (as long as python points to your python-3.x directory in your PATH):

python -m pip install <module>

Or alternatively, you can use pip3 to install it directly to python-3.x.

To use pip3, you need to navigate to:

C:\path\to\python\Scripts\pip3

and then run it as:

pip3 install <module>

and it will be installed to python-3.x rather than python-2.x.

Sign up to request clarification or add additional context in comments.

3 Comments

I tried that and get a message saying Python is not an internal or external command.
well then you can either add Python to your PATH (so you can call it from anywhere) or just run the above commands in the directory where you have Python installed.
Thanks. I did those things. It still doesn't do what I would expect it to do. Every six months or so I try to learn Python, but I can't ever get it to do even the most simple things, and then I give up for another 6 months. I think this should take less than 1 minute to setup, not hours and hours and hours. I just updated my original post with a couple new pics.
1

If you need to uninstall a Python just use Windows' Add/Remove programs and run the uninstaller for that specific version.

Later versions of Python include PyLauncher (py.exe) and install it to C:\Windows which is always in the path. Use it to control which Python to run and which pip to run if you have several installed. If you use this you won't have to add a specific version of Python or its Scripts directory (where pip.exe is) to your path.

Examples:

py -3 -m pip install <package>   # Use latest Python 3 installed.
py -2 -m pip install <package>   # Use latest Python 2.
py -3.3                          # Run Python 3.3
py -2.7-32                       # Run 32-Python 2.7 on a 64-bit OS.
py                               # Run default Python (usually latest 3.x)

The PY_PYTHON environment variable can override the default.

See also: Python Launcher for Windows

Comments

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.