I am currently working on a project that makes use of Python 3.2.3 and thought to do some tests of my code in IPython but it seems that IPython does not support the version of python I am using.
I get the following ImportError when trying to run Ipython on my Ubuntu machine.
ImportError: IPython requires Python version 2.7 or 3.3 or above.
You can find some discussion about dropping 2.6 and 3.2 support here. One of the main reasons was that 3.2 does not support 2.x-style unicode strings - u"I love IPython!", while 3.3 and above do. This change made it possible to support 2.7 and 3.3+ in a single codebase.
Quickstart:
IPython requires Python 2.7 or ≥ 3.3.
If you need to use Python 2.6 or 3.2, you can find IPython 1.0 here.
PS:
The deadsnakes PPA has packages for old and new python versions:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python3.3
Related
I install python 3.10 in my new laptop, i used python 3.10 for a long time and i installed lot of package on it, but i need to downgrade it to python 3.8 because python 3.10 cannot support a package, and i found this post but if i remove the whole python, it will also remove all the package, that mean i need to install all the package after i do it. Is there any way to just downgrade the python interpreter?
You can use it pyenv for working with multiple python versions;
curl https://pyenv.run | bash
Look at the available versions;
pyenv install --list
Installing selected version;
pyenv install -v 3.8.1
for more details;
https://realpython.com/intro-to-pyenv/
I was wondering if it is possible to use Cocoa (Apple's API) with Python, so being able to run any code like in this link, so NSWorkspace functions and so on, this might be a super stupid question, but I was still wondering if it was possible...
Yes.
There are Python packages, kind of wrappers around Objective-C, install them like:
$ pip install pyobjc-core
$ pip pyobjc-framework-Cocoa
$ pip pyobjc-framework-Quartz
https://pypi.org/project/pyobjc-framework-Cocoa/
MacOS by default comes with python 2.7 and pyObjC 2.5, and has done for years. If you want a newer version of either python, such as python 3, or the newest version of pyObjC, then you have to install it yourself.
The latest version of pyObjC is 5.2.
However, on a default installation of MacOS from at least Snow Leopard onward, the following should work:
python
>>> import Appkit
>>> AppKit.NSWorkspace.sharedWorkspace().runningApplications()
Catalina is stated to be the last version to contain python bundled.
I have been using Python 2.7 for a while now and installing packages using pip install without any issue. I just started using python 3 for a certain code and realized how confusing having different versions of Python can get.
I have Fedora 25, the default Python version is 2.7.13 and the default Python 3 version is Python 3.5.3,
I want to be able to use python 2.7 and python 3, my general question is:
What are the best practices when installing packages for both Python 2 and Python 3 on one machine?
As I mentioned using pip install in Python 2.7 works fine, but what about Python 3? I can:
use pip3 install
use python3 -m pip install
Which one should I use and how does it affect the python 2 version of the module? pip3 is not installed on Fedora 25, which raises a new question: how should I install it? as I understand I can:
use dnf install python3-pip (it is unclear if that actually works when pip for Python 2.7 is installed)
use python3 get-pip.py
Finally, would it be a good idea to create a Python 2 and a Python 3 virtual environment to address this issue?
From what I have read on the internet there does not seem to be a clear consensus on these questions, I hope this thread will clarify.
pip3 install and python3 -m pip install — both work perfectly and don't have any impact on Python 2. You can have as many Pythons in your system as you want; I for one have Python 2.7, 3.4, 3.5 and 3.6. To distinguish different versions of pip I use versioned names: pip3.4 install.
And of course I use virtual environments and virtualenvwrapper quite intensively.
I'm trying to run some modules in Python 3.4 that work fine for me in 2.7. tweepy and pexpect are two examples. Unfortunately, in 3.4 on the same Mac, I'm getting "ImportError: No module named 'pexpect'"
Looking at pypi.python.org, I see that tweepy lists Python 3 and Python 3.4 while pexpect lists only Python 3.
To rectify my problem, I've tried upgrading and sudo installing the modules through both pip and pip3.
I'm running Mac OSX El Capitan. I installed 3.4 via the download and instructions at python.org and not through homebrew, et al. pip --version returns: "pip 7.1.2 from /Library/Python/2.7/site-packages (python 2.7)"
I've seen similar questions on StackOverflow, but answers seem to be Linux specific (Importing modules that work in Python 2.7 but not Python 3.4 and How to use pip with Python 3.x alongside Python 2.x) or the answers are not working for me.
Can someone provide me with some insight into what I'm missing?
The Python 3 documentation on Installing Python Modules says that you must install pip for your version and call it per version. As it should be included in Python 3.4 (but unsure what vendor package managers do ...), the following is cited in referenced doc:
python3 -m pip install SomePackage # default Python 3
python3.4 -m pip install SomePackage # specifically Python 3.4
Python3 and Python2 have very separate package definitions. When you have a package installed for python2, it is definitely not installed for python3. Typically, python has a version of pip installed for each version of python. Such as pip3.3 or pip3.4 for python3 and pip 2.6 or pip 2.7 for python 2. If you're trying to use a package for python 2 it will not register as installed for python 3.
I have 3 python versions, I want to easy_install Orange using the second version. How can I do this?
Unnecessary info:
2.1 in /usr/bin/python
2.6 in /Library/Frameworks/Python.framework/Versions/2.6/bin/python
3.1 in /Library/Frameworks/Python.framework/Versions/3.1/bin/python
Answer:
Ok found it here (http://peak.telecommunity.com/DevCenter/EasyInstall#multiple-python-versions),
"Also, if you're working with Python version 2.4 or higher, you can run Python with -m easy_install to run that particular Python version's easy_install command"
Just so the answer is easy to find:
Using "Python-version" with the m-parameter and easy_install afterwards does the trick.
Example:
python2.7 -m easy_install https://bitbucket.org/james_taylor/bx-python/get/tip.tar.bz2
easy_install is usually/always installed per Python version. So you run the related version of easy_install installed for your particular Python version/interpreter you want to use here.
Say your python version is 3.5. Then you can use the command easy_install-3.5 followed by the name of the module you are willing to download/install. See documentation here.
From the doc, besides the reported option
python2.7 -m easy_install
there is also:
if you install EasyInstall for both Python 2.3 and 2.4, you can use the easy_install-2.3 or easy_install-2.4 scripts to install packages for Python 2.3 or 2.4