I was using gsutil API to connect to clusterdata-2011-2 (which is a Google cluster-usage traces of 29 days). it was worked perfectly. But after I have installed Anaconda3, it does not work anymore.
It says that gsutil requires python 2.6 or 2.7.
Even after adding an alias in .bashrc
alias python='/usr/bin/python2/'
It didn't work
Can you please help me?
I suspect your alias is wrong firstly...
alias python=/usr/bin/python2.7
Feels better.
Check your PATH i.e. $PATH
And try and Remove the Anaconda part...
euh it didn't work
but also i don't want to remove Anaconda cause i am working with it..
i am thinking about deploying a new VM ware machine without installing neither python3 nor anaconda
Thank u for your suggestion !!
Related
Yesterday I've been trying to install Python 3.8.5. I got the installer from the python website. My problem is that whenever I run python --version in the command line, it keeps saying, like in the image above, Python 2.7.17.
Today I also installed the Microsoft store package, and it's the same.
But running py apparently gives me the correct version 3.8.5. Does this mean that every python program I'll write will use the current version? That's what I currently want to make sure of.
As a side note also, I uninstalled all other python versions except 3.8.5 that I saw in my settings>Apps list. So, that adds to my confusion why running python --version would still show 2.7.17.
Maybe not as relevant, but I also have WSL2 enabled on my machine, I would like to install python to both. At the moment I'm focusing on the Windows10 part, but if there's a solution that will help both, that'll be awesome.
Thanks in advance!
[update]: adding python3 --version screenshot
[update]: yet another confusing part for me:
should I just let this be?
Is this something I need to straighten up first before moving forward?
are my python programs going to be ran in version 3.8.5 and not
2.7.17?
I know my answer is very late but i see a lot of people facing this problem. So if you want to interact with the latest Python version in your command prompt, you just need to set newer (or which one you want) Python path variable above/before other Python version's path variables. This solution also helped me a lot with other path problems.
This is a problem with your PATH environment variable being set incorrectly. I'm guessing that you installed Python 3 globally, after you had Python 2.7 installed. Whenever you do this and have the option Add to PATH checked, it will overwrite the default python location to the new install, thus causing Python 3 to now open instead. You can change this back manually by changing the value in PATH.
I'd suggest using something like pipenv to manage your python versions and respective libraries, that will create a sandbox for your application to run in and will always point to the correct dependencies.
Ok, so hopefully this fixes every question I had. Hopefully comments will assure me that is so.
What I did was, delete the environment variables relating to Python 27. Found the Python3.exe path and added that to the path variable. Not exactly sure how that works, but it did give me the outcome I wanted to see.
I just installed ubuntu 18.04 and I really don't know how does everything work yet. I use the last version of python in my windows system (3.8.1) and would like to use that version as well in ubuntu, but the "pre-installed" version of python is 2.7. Is there a way to uninstall that old version of python instead of changin the alias of the python command to match the version I want to use? Can you do that or does ubuntu need to have that version? If you could help me or explain this to me I would appreciate it.
It's not a good idea to remove Python 2 from your Ubuntu 18.04 because maybe some services or apps are using it (Despite that Python 2 doesn't get support any more)
(In Ubuntu 19.10, we have only Python 3)
The best answer is using Virtual Environments that make an isolate work station for you with any thing you wish, and it doesn't mess with other platforms.
Some services and application in Ubuntu use Python 2.x to run. It is not advisable to remove it. Rather, virtual environments maybe a good practice. There, you can work on Python 3.x, as per your needs, without messing up with the system's dependencies.
I installed python and then changed the c:/user/(username) of my computer.
After that I am unable to unistall/repair/modify python. I tired to downgrade and upgrade but failed with error windows cannot find the path.
How can I fix this? The version which was installed is 3.7.5 and I want to install the same or the lower versions.
edit: I tried to create a folder same from the error but it did not work. I tried to manually remove the python files too.
Try using the mklink utility.
mlkink C:\Users\vishn C:\Users\<yournewdir>
It's a hack, but it should let your system work through the python repair / modify / etc. problems.
When you're done, remove the "C:\Users\Vishn"; it won't delete the thing it points to, only the shortcut.
Finally did it with help of a third party application called Revo uninstaller.
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.
I opened a ticket with hostgator but trying to fix this on my own.
On my shared hostgator account, when I do python -V. It gives me 2.6.6
I need to use 2.7 which they do have, but doesn't work on my shebang line.
1)So, how do I change my python command to point to 2.7
I tried modifying the .bash_profile but the 2.7 path is added at the end.
2)Actually my shebang line needs to work as well.
I found the below comment for the same problem posted by someone else on Google Groups. I am also experiencing the same problem, but haven't yet tried the below mentioned approach yet. Please try if you find it might help.
Google Groups link
Hi, I'm also using hostgator to host a django project.
first of all note that they have different plans with different features, what I'm going to write applies to their shared hosting plans.
Looks like they are using some version of centos, which comes with python 2.6 I believe.
Installing a python from source on your home folder is a good idea, but unfortunately hostgator blocks access to gcc.
on the other hand they already have python 2.7.3 installed, juts use python2.7 as the executable, try running "python2.7 -V"
btw, they also have python2.6 for 2.6.6 and python3 for 3.2.3
after that you should use virtualenv to create a project specific env so you can install things using pip. download the virtualenv.py file to you project folder and run it from there. for the index.fcgi file you should put this in the first line:
#!/home/username/projectname/env/bin/python
other than that I think it should be standard