MacOS Sierra 10.12.1 - selenium - which version of Python? - python

I plan to install Python and Selenium on MacOS 10.12.1.
What would be the better choice - Python 2.7 or 3.6.5? On windows I use 2.7, because I read that it works faster. But are there any proven obstacles while working with Python 3 and Selenium on Mac?

I have been using Python 3 for quite a long time now. There is not really a performance issue that is quite noticeable. I would suggest Python 3 or which ever is the newer one because as they keep developing they will be adding new things that you might need and remove some older vulnerabilities. I would suggest you upgrade to Python 3. There might be some getting used to the new syntax but it can be quickly come over as you keep developing.

Related

Running modern Python on legacy Windows

I have some code developed in Python, which makes heavy use of Python 3 language features, such as f-strings (which require Python 3.6 or later).
Due to a customer commission I have found myself in the situation that this code needs to run on Windows Server 2003. Python has officially dropped support for legacy versions of Windows sometime around the release of Python 3.5.
Is there a "port" (I guess this would be the best way to call it) of Python 3.6 to legacy Windows, or does anyone have a good idea of how to get my code to run without doing too much heavy lifting?

python3.7 biopython, how to learn python3 and still use biopython

I'm very new to python and biopython, currently using a mac. I have python v2.7 and v3.7, and I would like to be learning with python3. Biopython only works on v2.7. Is it worth installing python V3.4 as well as these other 2 versions so I can learn python3 and use biopython? Or remove python3.7 and add 3.4? Even if I install python3.4 will biopython work if it was installed prior? Very confused biologist here.
Firstly, check out this page: https://biopython.org/wiki/Download
You don't have to worry about biopython being bound to a specific version of python - you can use it with either v2.7 or v3.4/v3.5/v3.6. You can also have multiple version installed on your system but I recommend you to focus on digging deeper into one of them. Personally, I work now for several years with python3.x (at the moment 3.6) but I know a lot of people sticking to v2.7.
Having also a bioinformatics background, one thing that I can highly recommend you at the beginning of your journey is taking a course such as:
https://www.coursera.org/specializations/python
There is also a bunch of free tutorials on youtube - you will easily find one that fits your needs by searching for "python tutorial" or "python getting started".
Get yourself comfortable with the language, check out the basics such as data structures, databases, and data visualization. Check also some "python cheat sheets" - they can help you pick up the basic concepts of the language.
All the best and keep on coding!
From the biopython installation document:
Biopython is designed to work with Python 2.5 to 2.7 inclusive. Python 2.7 is the final 2.x series release, and this would be our recommended version (assuming all other Python libraries you plan to use support it).
Upgrading bug-fix releases (for example. 2.6.1 to 2.6.2) is incredibly easy and won’t require any re-installation of libraries.
Upgrading between versions (e.g. 2.6 to 2.7) is more time consuming since you need to re-install all libraries you have added to python.
As of Biopython 1.62 we officially support Python 3, specifically Python 3.3. Python 3.0, 3.1 and 3.2 will not be supported.
Also from the Biopython website:
Python 2.7, 3.4, 3.5, or 3.6 or PyPy, including the Python development header files like python.h
So biopython is inconsistent with their documentation.
I think your best option is to download either the latest version of Python 2 or 3 and see if it works.

Which Python version to use for using BeautifulSoup and urllib?

I'm working on web crawling using Python. I had issues while using Python version 3. So I wanted to know which version of Python is suitable for web crawling.
I think there is definitely a counter-argument to making the move to Python 2.7. There is no reason that I can think of, particularly for web crawling, that you would need to revert to Python 2.7.
BeautifulSoup 4 and lxml are both fully ported to Python 3.5.
urllib is fully functional in Python 3.5. You should be aware that there are differences in the implementation of urllib in Python 2.7 and Python 3.5.
However, I would suggest you use the Requests package instead of urllib. Here is a post highlighting some of their differences.
If you need to load pages that require javascript, Selenium also works in Python 3.5. Selenium can also support headless browsing (e.g., PhantomJS).
Also, here is an official post from Python that can help guide you to your decision.
If you do opt to install one of the standard Python distributions,
make sure you have Python 2.7.3 or later, but do not use Python 3.0 or
later; these versions are, of course, the cutting edge versions, but
many of the packages we will be using do not yet have Python 3.X
support, and until they do, 3.X is not that appealing. For a good
discussion of what is and is not available in Python 3.X, see Choosing
Python versions.
Got this of a website which introduces and discusses web-cralling for Python. I would suggest you take their advice. I have also experienced that Python 2.7.* is the best for application at the moment for using additional packages.

Is it ok to install both Python 2.7 and 3.5?

Supposedly Python 2.7 is included native to OSX 10.8 and above (if I remember correctly), but I recently installed Python 3.5 to use for projects while I work through UDacity. Lo and behold, the UDacity courses seem to use 2.7 - wups! So instead of trying to uninstall 3.5 (this procedure seemed to scary for neophytes such as myself), I simply installed 2.7 in addition to the recently installed 3.5 and just run the 2.7 IDLE and Shell. Is this ok, or will I run into problems down the road?
I have installed two versions, 2.7, 3.4 and I do not have any problem by now. 3.4 I am using for my work project in eclipse environment, 2.7 for udacity course, like You ;).
As long as you keep your installation folders organized, you should have no issues having both on your computer, besides one thing. The path environment variable for python will determine which version is used by default, so I would say stick to one version, or make sure to make your programs as backwards compatible as possible. I have run into this issue on Windows, since I installed Python 3.4 before 2.7, and therefore to run older code, I have to manually select the python executable. In terms of libraries, I believe that for each python version, the libraries are completely separate, so you should be good there.
As others have said, if the installation directory is different it should be no problem at all.
One thing that'll make your life easier for switching between the two is to use an IDE such as PyCharm, you just have to change a drop down to switch between the two versions.
It should be fine. Its actually pretty common to have multiple Python environments. It helps to prevent dependency conflicts between your projects. That is what is happening when you are using tools like pyenv and virtualenv.
Using tools like pyenv and virtualenv may also help you with the path problems that others mentioned. They have commands to set up the path so that their version of pip, python, etc are used.
Im not sure about OSX, but with windows 10 my environment variables for 2.7 were overwritten with the 3.5 path. Not a tough fix, but a little confusing, since it was months later when I needed 2.7 again.
You can also use Anaconda for maintaining two versions of Python:
Download Anaconda for both Python versions
Open .bashrc
Add the path to new Anaconda you have installed for, e.g.:
export PATH="/home/paras/anaconda3/bin:$PATH"
Now there will be 2 export paths: one for Python 2 and one for Python 3. Comment the one which you don't want.
I have the same problem and it is not necessary to uninstall on version of python. Please take care to not mix them up - When you search them up on the start menu. You can make a desktop shortcut saying 2.6 and 3.5.

How to uninstall and/or manage multiple versions of python in OS X 10.10.3

I have installed the Python IDE Spyder. For me it's a great development environment.
Some how in this process I have managed to install three versions of Python on my system.These can be located as following:
Version 2.7.6 from the OS X Terminal;
Version 2.7.8 from the Spyder Console; and
Version 2.7.9rc1 from an IDL window.
The problem I have is (I think) that the multiple versions are preventing Spyder from working correctly.
So how do I confirm that 2.7.6 is the latest version supported by Apple and is there a simple way ('silver bullet') to remove other versions from my system.
I hope this is the correct forum for this question. If not I would appreciate suggestions where I could go for help.
I want to keep my life simple and to develop python software in the Spyder IDE. I am not an OS X guru and I really don't want to get into a heavy duty command line action. To that end I just want to delete/uninstall the 'unofficial versions' of Python. Surely there must be an easy way to do this - perhaps 'pip uninstall Python-2.7.9rc1' or some such. The problem is that I am hesitant to try this due to the fear that it will crash my system.
Help on this would be greatly appreciated.
(Spyder dev here) There is no simple way to do what you ask for, at least for the Python version that comes with Spyder.
I imagine you downloaded and installed our DMG package. That package comes with its own Python version as part of the application (along with several important scientific packages), so it can't be removed because that would imply to remove Spyder itself :-)
I don't know how you installed IDL(E?), so I can't advise you on how to remove it.

Categories