I was trying to install Python 3.7 using homebrew with "brew install python". When I check the version of python installed, I get python 2.7.10. Anyone know how to fix this?
Most likely you need to call python 3.7 commands with
python3
and install packages with
pip3
as well, also check your $PATH configuration, as is it usually takes the OSx python as default in Macs
Related
I have used python 3.8.13 as installed by Homebrew for years, mostly with jupyter-lab for coding in notebooks. Recently I ran brew to install a package and it looks like it installed python 3.10: brew list shows both python#3.8 and python#3.10 and running python3 from the command line gives me a 3.10 session, with no knowledge of my site-packages...
I either want to:
remove python 3.10 and continue using 3.8 as I was. python#3.8 would then be the python3 command as it was before.
or
change over to using python 3.10 and have all the site-packages installed when using 3.8 "come with". In particular, jupyter-lab needs to know about them in the 3.10 environment so my notebooks keep working.
Could someone help me with either of these? I'm not familiar enough with brew or python to clearly see how to do either to completion. Thanks so much.
I have both Python 3.5 and 3.6 installed on an Ubuntu Machine. Spyder3 uses 3.5 but pip3 uses 3.6 by default. Spyder gives an error message upon launch that a dependency is not met. So I have to either tell Spyder3 to use Python 3.6 or tell pip3 to use 3.5 but I don't know how.
No need to change any of those, you can install a package for a specific version of python by calling pip through python as a module like this:
python3.5 -m pip install tkinter
Replace python3.5 with the target version and tkinter with the target module that is required.
Hope this helps!
I have installed version 3.8.2 on my RPI because i previously had versions 2.7 and 3.5.3 installed. When I try to install stuff like ipython i get this: ERROR: Package 'ipython' requires a different Python: 3.5.3 not in '>=3.6'.
Tried various stuff and nothing works. Modified paths, installed 3.8.2 multiple times, tried to remove 3.5.3. Nothing works. It appareas the base version is 3.5 but I need it to be 3.8.2 and no idea how to do that.
Also when i try to run a python file I get the error that it cannot find numpy, and I have numpy installed in all versions.
Struggled for over a day to fix it and nothing. Can anybody help?
versions of python on RPI
Python is a requirement of Debian, hence uninstalling the version present by default is not recommended (it basically breaks the system).
If you need to run python 3.8 you should install it manually and call it with
python3.8 what_you_need.py
Also for pip:
python3.8 -m pip install what_you_need
I also suggest you to have a look to virtual environments:
https://docs.python.org/3/library/venv.html
https://github.com/pypa/pipenv
I can download python 2.7.12 from python.org, and all python versions from 2.7.9 onwards are supposed to come with pip, but after installing it, using pip in the terminal does not work.
I am on macOS.
Have I installed pip, and if I have, how do I use it?
Here you have informations about pip:
https://packaging.python.org/installing/
normally python from python.org come with pip, maybe you should just update...
to update from terminal:
pip install -U pip setuptools
After when you need to install package, for example numpy, just do in a terminal:
pip install numpy
more informations here :
https://pip.pypa.io/en/stable/reference/pip_install/
you can also use conda install from anaconda as an alternative of pip :
http://conda.pydata.org/docs/get-started.html
Multiple instances of Python can coexist on your machine. Thus you could have installed Python 2.7.12 yet, when you call Python from terminal, you may be calling an older version.
To know which version you are using, type which python in terminal and look at its path. Then from Python in terminal, type
import sys
print(sys.version)
to get the exact version.
As Dadep says, I would recommend using conda to isolate your invironments if you have to play with multiple Python interpreters. Further conda simplifies 3rd party package installation process beyond doubt.
I had python 2.6 and I downloaded Django. I found that python 2.6 throws errors when trying to run django, so I downloaded python 2.7. Now, typing python in the terminal runs 2.7 but the django library isn't in the 2.7 folder. So I uninstalled django using:
sudo pip uninstall django
and that worked just fine. When i used the command:
sudo pip install django
it installed into the python 2.6 instead of python 2.7.
How can I install django into python 2.7 instead of python 2.6?
(I am running a MacBook Pro on 1.6, and I was told to not uninstall the base version of python because so many of the systems use 2.6)
You need to install pip for python2.7. If it's installed, you should be able to see it using which pip-2.7.
It's better not to touch system python. Use homebrew to install your own.
The problem is that you are running pip from your default Python installation (2.6), read this: How to run multiple python version on Windows, maybe answers give you how to solve in your OS X.
You can view the version of your default Python installation by executing python -V, there is a way to specify which version to use when you execute python, in Linux you can create an alias (alias python=python2.7) in your $HOME/.bash_profile, OS X must have something similar, then install pip using your preferred version.
BTW, It's recommended to use virtualenv