I run a script on several CentOS machines that compiles Python 2.7.6 from source and installs it. I would now like to update the script so that it updates Python to 2.7.12, and don't really know how to tackle this.
Should I do this exactly the same way, just with source code of higher version, and it will overwrite the old Python version?
Should I first uninstall the old Python version? If so, then how?
Sorry if this is trivial - I tried Googleing and searching through Stack, but did not found anyone with a similar problem.
Replacing 2.7.6 with 2.7.12 would be fine using the procedure you linked.
There should be no real problems with libraries installed with pip easy_install as the version updates are minor.
Worst comes to worst and there is a library conflict it would be because the python library used for compiling may be different and you can always reinstall the library which would recompile against the correct python library if required. This is only problematic if the library being installed is actually compiled against the python library. Pure python packages would not be affected.
If you were doing a major version change this would be okay as well as on CentOS you have to call python with python2.7 and not python, so a new version would call with python2.8
Related
I am trying to follow an online tutorial that is a little outdated. But I like the instructor and how he follows his curriculum. He is using python 2.7 in the video and an older version of pyserial (2.6 I believe) that I can no longer find a download for. I went ahead and installed the latest python (3.7), along with the latest revision of pyserial (3.4). And both installed successfully without problems.
However the other IDE-looking program which he uses to code our scripts ("vPython or videl for python"), only supports python versions up to 2.7.9
This made me back-trace and also install an older revision of python (2.7) in a separate directory with python 3.7 still being installed in another.
Since the older version of pyserial is no longer available, I tried to install the newer pyserial 3.4 package using python 2.7 but every time I do it through the windows command line, it gives me an error saying "the module 'serial' is not available'.
This is already after I had extracted the pyserial 3.4 package into the python 2.7 "Lib\site-packages\" directory. And we can clearly see that the 'serial' folder is definitely in the 2.7 python library.
I'm wondering if it cannot install the module because of the differences in revisions or if it's because the command line terminal is defaulting to the latest version of python (3.7) automatically to execute the installation.
If this is incompatible, maybe someone can help provide a link to the older version of pyserial or help me find another solution to this problem.
Edit: I found a version of pyserial 2.7 but it is for 32 bit windows and not 64. I have been sticking to versions of 64 bit for python and vpython.
So I found an older version of pyserial 2.7 for windows 32 bit. I'm not sure if pyserial had a 64 bit version at the time 2.7 was released because I could not find it. I uninstalled python 2.7 64 bit and replaced it with 32 bit, and then did the same for vpython.
This got the program up and running successfully and importing the serial libraries just fine.
The next problem was that the 32 bit vpython and 64 bit arduino's did not play nice together. And I could not get vpython to read serial data from arduino despite copying code verbatum and having it compile correctly.
My solution was just to use the pycharm IDE instead. It has a package installer that just downloads and installs everything for you. Thank god too because I spent around 3 hours trying to get the packages installed manually through the command terminal but kept running into compatibility issues like outdated published files, an annoying syntax error through cmd, a "not supported on this platform" error (despite pip and everything being 100% kosher) and not having microsoft C++ version 14 AND HAVING NO IDEA THIS RESOURCE WAS MISSING.
But pycharm solved all of that. Sorry for the somewhat salty response. I just hope it saves someone else's time. Pretty upset this wasn't suggested on any of the official websites anywhere.
I have installed on my MacBook Air (v10.10.5) a number of different Python Versions (2.7, 2.6 + 3). I have tried changing python PATH settings, however, it has become too awkward to maintain. Because of this, I wish to uninstall all versions (without damaging my OS) and then clean install Python 3. How can I do this?
First of, you cannot (and should not!) uninstall a version of python that is shipped with macOS. They are shipped for a reason and might break your system as soon as you remove them (as a lot of essential processes might rely on them).
Python2.7 for instance has been shipped with macOS for a long time. However, you are also able to download and install the same version of python (e.g. 2.7) yourself, which usually means you end up with conflicting versions and controlling your PATH becomes a fulltime job.
You are always safe to remove those versions that you installed yourself (but only those!).
How to do so depends greatly on how you installed them. If you've done so via downloaded packages of python.org look here for uninstall instructions. If you used another application like brew or macports you need to follow the guidelines of those programs which could be easily fetched via a Google search.
Good luck!
I basically use python 3.4 and the numpy 1.3.0 had been installed and launched successfully on my windows machine.
Recently, I've just installed python 2.7, in order to use Brian2 library, but I've an error in traceback as Importing numpy failed: No module named numpy, whereas it has been installed and works well under aegis of python 3.4
Actually, when I switch the interpreter address to python 2.7, the problem will be happened, in which the numpy is totally hidden in view of the python 2.7...
Any help?!
Edit:
I even tried to choose python 2.7 (As it was detected automatically in registry), within the re-installation of numpy... but still there is nothing as the installed package in Python Interpreters -> Python 2.7
Python x.y (on Windows) generally expects to find 3rd party modules and packages in .../pythonxy/Lib/site-packages. If the module or package is pure python code that is compatible with multiple python versions (such as code that works with 2.6 and 2.7, or 3.3 and 3.4, or much more rarely 2.7 and 3.4), then it is possible to access one copy of the package from multiple site-packages directories. (This is done with x.pth files, which is another topic not relevant here.)
However, on Windows, anything compiled from C must be compiled for Windows and a particular version of Python, including 32 versus 64 bits. (This is currently a requirement of Microsoft C, which may change in the future.) To run with 3.4.x, you installed numpy-1.3.0-for-3.4-winxx. To run with 2.7, you must install numpy compiled for 2.7.
By the way, current numpy is 1.8, with 1.9 due soon. You might want to take the opportunity to upgrade. If you have trouble getting Windows binaries for python extensions, gohlke's site is excellent.
I've started to use python and recently i've bought my first mac.
I saw that Mountain Lion comes with their own python versions, despite i've decided to install a new python 2.7.5, and also Django and MySQL-Python. Everything works fine.
I've decided to try scipy and following the installed steps suggested by the official site with macports It seemed that macports installed another version 2.7.5 of python. Now if i try to run python in my terminal and import numpy it fails.
I saw that when i run python in my terminal, it execute
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
But if I go in
cd /System/Library/Frameworks/Python.framework/Versions/2.7/bin
and run ./python i can import django and numpy modules but not MySQLdb modules.
I'm really confused how I can fix that mess.
I would like to have just one Python version installed in one place with all the modules I need.
Or please suggest something to clean that mess, know and have the control to what modules I have, where they are and how to import them! And also control which version of Python I want to run.
Edit 10/27/2013: i've solved following the link suggested in the comment, deleting all versions in /Library/ and all simlinks in /usr/local/bin, after that i changed to the path i wanted the py interpreter in my bash_profile.
Actually the problems seems to be created by macports that has installed numpy using the py interpreter installed under /System/, so i changed my default py interpreter to that installed under /System/ and installed the rest of packages i need. Now everything works as i want.
Personally, I wouldn't mess around with the built-in version of Python. I had some real issues with my Mac when I did that a few months ago.
You could try Canopy instead. It's a Python development environment which is great for writing and executing code. Any packages you need can be easily added (or removed) using the package manager. https://www.enthought.com/products/canopy/
I've installed Python 2.7 using macports and because of my $PATH variable, that's the one I get when I type $ python. However, virtualenv defaults to using Python 2.6 unless I remember to force it to do otherwise with the -p flag.
On a related note, globally running yolk -l shows the following:
Python - 2.6.1 - active development (/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload)
So my question is, should I do something to ensure the system is always using MacPorts' Python 2.7 or is it not worth worrying that Apple's Python 2.6.1 is apparently in the mix?
If you force python 2.7 globally on your system, things will break. You don't want to do that.
You should use virtualenvwrapper. It should choose your preferred python.
http://www.doughellmann.com/docs/virtualenvwrapper/install.html#python-interpreter-virtualenv-and-path
I have had similar problems, although not related specifically to virtualenv. I found that, after installing a particular version of python with macports, and having that version set as default, installing 3rd party modules that are build on or use python using macports solved all problems. You essentially end up with parallel builds, on top of different versions of python. I have a few, and switch between them using python_select. Also, see here on SO for how to get easy_install to work with your new python.