Old-time user, first-time asker here,
I am very new to Python, and I started by downloading Anaconda with Pyhon 3.6. I tried to get gcalcli to work, but it's having big Python version conflicts. It looks like gcalcli was made for Python 2, but then my "default" Python is 3. Many of the modules gcacli needs have also been installed for Python 3. I think that even the print command has changed between the two versions.
I believe I have all the necessary modules installed: Google API Client, dateutil, gflag, but their versions might be part of the problem.
I can run gcalcli from Python 2 (by changing the first line in the gcalcli file) but it will crash when a Python 3 module is needed and the syntax is strange. I also tried running gcacli from Python 3, but the same happens when it runs into syntax that only works for Python 2.
I tried copying the content in the Python36/Lib folders to Python27/Lib, and run gcalcli from Python 2. That helped the program run a bit further, until it ran into another incompatible bit of syntax. In other words, I'm kinda trapped in version hell.
Has anyone found a solution for this kind of version and script/module compatibility problem?
Thank you, very much.
Related
I'll preface this with that until last week, my entire experience with linux can be summarized by some long-forgotten class in school 10 years ago, plus my recent use of Git Bash on Windows. Bear with me!
I've recently started working with GCP to do data-sciency stuff. I created a VM instance to load and process a bunch of data using a Python script I wrote.
However, when I start the instance, I see that it's using Python 2.7, so I naturally tried to figure out how to install or update Python. www.python.org said that I'd likely have to build the library from source code, so that's what I learned how to do (thanks SO).
Now, as I'm trying to run my script, I keep getting errors due to missing modules. A little research told me that these are core library modules that are missing... As in they should be part of my Python environment already. So I keep pip installing these missing modules, but each and every time, I have to re-build Python from scratch in order for the newly installed modules to be recognized.
Let's just say, that's not fun for a Windows los... user.
So, how do I get a Python distribution that has all the regular libraries already installed, like I would on Windows?
I ran into the same problem as here. So I tried to install python developer package but I didn't find the way to do this.
Cython's helloworld instruction doesn't contain any info about it, which seems strange and stupid to me to not include basic requirements into instruction, named "Basic Tutorial" (Sorry if I don't get something about it.)
Anyway... I'm using Windows 10, PyCharm, virtual environment with python 3. When I went to package install window, search result contained 5 packages:
So, which one?
I tried to install one, but it gives me an error:
I met this error in the past with some other package already. PyCharm's suggestion is to run that command from terminal. But from my experience that never helped. Usually solution was either to change name (because some names are right for Python 2.x, other for Python 3.x), or to download the package (egg/wheel) manually and install it offline.
This question was asked before already, but that one is for linux, which is not the case for me.
Can someone save some time for me and future generations, please? ;)
How do I install it and make Cython's helloworld example work?
I would like to upgrade my Python version from 2.6.6 to the newest version of 3.6.5 on a server. However, there is a program that has been running for multiple days and will be running for a week or more.
Will my program continue to run until it finishes if I upgrade my Python version?
P.S.: I ran my Python program with the screen command so I wouldn't have to stop it to be able to upgrade my Python version.
Yes, your Python 2 script should continue to run while you install/upgrade Python 3, since Python 2 and 3 are different programs.
However, the installation will be be platform specific and there might be common dependencies, so I would test this on a different machine (e.g. local virtual machine) first.
Several aspects are to be considered here:
In general, a Python program that is running does not access the installed binaries of the interpreter anymore. Also all the modules already loaded will not be read again from disk during the execution time of this program. (In this aspect it differs from e. g. a Bash script which reads its script source while executing.) So you probably are safe in even removing the complete Python installation; of course that's not what you plan on and I wouldn't recommend it for other reasons, but even that should not influence your running Python program. If, however, your running Python program tries to import a module for the first time after the removal or upgrade of your Python installation, this might fail due to incompatibilities between the versions. Most programs do their imports only at the beginning of their runtime, though.
Python 2 and 3 are different languages. Scripts for the one need to be at least adjusted to run with the other. Adjustments aren't too hard to do, though. Most distributions have both installed side-by-side. Most of the time, Python2 is still standard (and accessed by typing python). python2 and python3 are then to make it explicit. This means that you probably should not remove Python 2 from your system, even if you plan on installing Python 3. There probably are scripts relying on the installation of Python 2.
There's a lot going on here that you've not explained/described, so it's hard to give you a definitive answer (such as the operating system you're using). This is also not exactly a programming question, so you might find that the question gets voted to close. That said...
It possible to run multiple versions of Python side by side. Because 2.x and 3.x are very different, it might be much better to have both versions installed. See this answer for some details on doing that:
Official multiple Python versions on the same machine?
It's likely that your code will need some modifications to run on Python 3, so you're going to have to redeploy a new version of your code at some point anyway.
So I installed python 2.7.11 a few months ago, now the class I'm about to take uses 3. So I installed 3 and it works fine. I also uninstalled 2.7.11 by going to applications and removing it, but going to terminal and typing which python, the directory is Library/Frameworks/Python.framework/Versions/2.7/bin/python, which means this it's still not removed.
What should I do...leave it alone? I only need Python 3, but this is bothering me a bit.
Thanks.
This doesn't answer the question in the post's title, but leave Python 2 as the default python. If you want to run Python 3, you run python3 or maybe python3.4 or python3.5, depending on your installation. The system and other third-party software depend on python being Python 2. If you change it, you may encounter puzzles down the road.
I'm not sure if having a third-party Python 2 is good (OS X ships with Python 2 already), but it should be fine.
Edit: Sorry, didn't see there was already an answer. It was posted as I was typing.
I'm having issues with Python on my 2013 MacBook Air. It seems to be mostly related to pathing, looking for libs in the wrong location based on where the calling lib was installed. I'd like to remove Python from my system and start fresh.
The specific reason I'm asking is due to a virtualenv problem. I created an env with the no-site-packages flag, but when I start my app with foreman, I get an error telling me that Flask isn't available yet when I open a python shell and "import flask", it works fine.
I don't really care which version of Python, or where it's installed as long as everything is consistent. Could I get advisement on how to proceed?
To be clear, I don't think this is a Yosemite issue, just mentioning it as a potential variable.