Has anyone had this problem: when trying to install python>=3.6.6 by typing sudo apt-get install python>=3.6.6, to get another version? I get 3.5.3 and I do not understand why it happens so.
Could anyone help?
Thanks!
The version of python installed through apt is determined by the configuration in /etc/apt/sources.list. You can modified it to add additional sources but it is not recommended to do so since it may cause unexpected problems. A more safe way is to use anaconda or miniconda to manage your python environment. You can install any version of python through conda. Refer to this tutorial.
Related
I'm running macOS 11.2.2 Big Sur and I'm trying to get pip to work with the latest Python 3.9.4. This turned out to be ridiculously difficult even though I've read a number of articles on the subject. Possibly, it is the debris I accumulated in the system over the years which is causing me trouble. I need advice as to how to get things right again.
Checklist:
/usr/local/opt/python/bin/python3 --version is Python 3.9.4 installed from brew in the most usual way; it's a symlink to ../Frameworks/Python.framework/Versions/3.9/bin/python3, which is in Cellar.
Both python and python3 commands are aliased to /usr/local/opt/python/bin/python3, they give the correct version.
I used both get-pip.py and ensurepip, and both of them say everything is fine: "Successfully installed pip-21.1.1 setuptools-56.0.0"
The only thing in env that has anything to do with Python is this part of PATH: /usr/local/opt/python#3.9/Frameworks/Python.framework/Versions/3.9/bin. The lack of this one is reported as warning when you install pip.
Still, I get this:
python -m pip --version
/usr/local/opt/python#3.9/bin/python3.9: No module named pip
What am I missing? 🤯
I also found this article that instructs to use pyenv, but running it on the latest macOS is yet another problem: pyenv install 3.9.4 doesn't build for some reason.
Using pointers from #gold_cy in the comments I was able to resolve the problem by running get-pip.py with an additional parameter: --prefix=/usr/local/.
While the official pip installation guide does mention that there may be problems on the systems like macOS that manage their own Python install, it doesn't say directly what you can do about it. Which is a shame, because the phrasing in PyPA » Python Packaging User Guide » Tutorials » Installing Packages is exactly the same, only the last phrase is missing from pip's page:
Warning Be cautious if you’re using a Python install that’s managed by your
operating system or another package manager. get-pip.py does not coordinate
with those tools, and may leave your system in an inconsistent state. You can
use python get-pip.py --prefix=/usr/local/ to install in /usr/local which is
designed for locally-installed software.
I was trying to resolve the problem for python3 in MacOS. The accepted answer didn't help me.
What helped me is complete reinstall of the python3:
brew uninstall python3 # if python3 worked before
brew install python3
I used Python 3.8.6, installed via Homebrew on my Mac (Mac OS 11.1), and everything was fine. After upgrading Python to 3.9 (and later 3.9.1) with Homebrew, there is an issue with one of the moduls which might be caused by that and I want to go back.
Trouble with Python versions seems to be a quite common and there are tons of articles etc. about that, but so far nothing worked for me. pyenv is often recommended, but actually I do not need the 3.9 version at the moment and did not want to introduce another layer of complexity.
I found a tempting thread for a similar situation but following these advices confused somehow my pipenv which somehow still sticks to Python 3.9. (Update: meanwhile I could solve that problem).
Anyway, my idea was to simply run brew uninstall python and then brew install python#3.8 (or however addressing the 3.8 version works).
If I try so, there is a warning:
% brew uninstall python
Error: Refusing to uninstall /usr/local/Cellar/python#3.9/3.9.1
because it is required by ffmpeg, glib, gobject-introspection, libass and libxml2, which are currently installed.
You can override this and force removal with:
brew uninstall --ignore-dependencies python
Is it a good idea to ignore the dependencies? I assume everything will get fixed via installing the 3.8 version later, or at least brew doctor would somehow help me if something will go wrong by that.
By the way: how exactly is the brew command for installing Python 3.8?
i just installed python on my mac and i had also installed VS code with it. Later i tried installing pygame but it didn't work so i found another version that installed the version that is not stable, or pygame2.0.0.dev6 - i think that is have you type it. So that went succesfull, but after i found out why i was not being able to install the stable version, so now i want to get rid of pygame2.0.0.dev6 and install the stable version because in my VS code editor it keeps saying that it is using pygame2.0.0.dev6 even when i have the stable version installed.
Please all i want is to uninstall pygame2.0.0.dev6. I tried going to the documentation and i tried uninstalling from the terminal itself but i still cannot uninstall it. Help would me much appreciated. Thank you!
pip3 uninstall pygame==2.0.0.dev6
Windows users should use pip instead of pip3
Always use virtual environments. This version problem will be mitigated.
I believe that I have installed virtualenvwrapper incorrectly (the perils of following different tutorials for python setup).
I would like to remove the extension completely from my Mac OSX system but there seems to be no documentation on how to do this.
Does anyone know how to completely reverse the installation? Its wreaking havoc with my attempts to compile python scripts.
pip uninstall virtualenvwrapper
Or
sudo pip uninstall virtualenvwrapper
worked for me.
On windows - This works great
pip uninstall virtualenvwrapper-win
I am new at Python and Ubuntu. I really struggle to decide the best way of installing Python packages on Ubuntu. I am using VIM so I cannot use Anaconda since they do no "talk".
I have two options:
Install with: pip3 install --user foo. This works find but according to python4astronomers you should never use --user. It will work very bad.
Use apt-get but then I got old packages
Use sudo pip, but that can get bad code into my system.
I do not want to use virtual environments. I want to be able to use all packages I have installed when I use Python. I normally use Jupyter.
I find it strange that Python installation is so difficult on Linux compared with Windows.
Which of these is the correct way?