I'm using a third-party Python package that supports Python 3.5, but not 3.6. I've got Python 2.7 installed from my OS vendor (it's a Mac), and Python 3.6 installed through homebrew.
What's the best way for me to install 3.5 and configure IntelliJ IDEA (using its Python plugin, so it's basically equivalent to PyCharm) to use it?
You can install as many Python distributions as you want and they all located in /Library/Frameworks/Python.framework/Versions. However, pip3 will only be linked to the last python distribution you installed, not the latest. For example, in my case, my pip3 is the module in python3.5 because I installed it after 3.6. If you want to use a package for a specific version, run $ python3.x -m package. python3.6 -m pip install, for example.
Related
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 am attempting to install django framework using pip install -e django/, however, it requires Python 3.5+. Mac OSX by default comes with Python 2.7 so I have installed Python 3.6.5 from the python website.
I have confirmed the latest version of Python is installed through python3 .
I am still unable to install Django likely because Python 2.7 is also installed and seen first by pip.
Is it necessary to remove Python 2.7 from my system or can I modify PYTHON_HOME to achieve what I would like to do?
You can install to python 3 using
pip3 install django
python3 -m pip install django
As abarnert says in the comments, you shouldn't remove the Python 2.7 installation or try to set Python 3 to be the default.
It's good practice to use a virtual environment. Since you're using Python 3 you could use pipenv. Once the Python 3 virtual environment is activated, python will use the python 3 from the virtual environment.
I am using a Python on a Mac and I know that Python 2 comes preinstalled on the system (and in fact usable through Terminal). Is there a way to make it so Terminal can run Python 3? Can/should you set this as a default? I know changing the default settings for Python version usage could break your system so should I just install Python 3 and then use it through its launch icon instead?
Use can use python version management tool
https://github.com/yyuu/pyenv
Package manager:
pip3 install something
Interpreter:
python3
You can use python 3 in terminal after you have python 3 installed. Every time you run a command type python3 instead of python if you are using pip to install modules you can do this:
But you must have pip installed for python 3
$ python3 -m pip install something
Best option is to install Python through Anaconda. This allows easy management and much more. You can have virtual environments having different Python versions as well as different modules installed.
as usual in Mac python 2.7 is already installed, however if you installed python 3+
then you can just type in terminal: python3
so that you can use the newer version that you installed.
if you want to use python 2.7 then just type: python
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