This question already has answers here:
How to run pip from different versions of python using the python command?
(4 answers)
Closed 4 years ago.
I have installed Python 3.7 I can use Python 3.7 by typing python3 command in terminal.
However if i type pip --version or pip3 --version it prints pip 18.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5) in either case. So i cannot install packages to use with Python3.7
How can i set pip3 path and Python version to use it with Python3.7 ?
BTW i use Raspbian Stretch as OS.
Your path is probably not properly configured.
In general, it's best to leave system Python version untouched to avoid breaking things.
I would recommend using pyenv to manage and easily switch Python versions. It can easily work with virtual environments as well, or even as a substitute.
Install from here: https://github.com/pyenv/pyenv#installation
Related
This question already has answers here:
Dealing with multiple Python versions and PIP?
(28 answers)
Closed 1 year ago.
I have both python 3.8 and 3.9 on my Mac. when I install a new package by pip3 install ..., the package will go to the python 3.9 folder, but apparently the executable commands to run in terminal is in python 3.8 folder, so even though I installed a package, I cannot run the command lines come with it.
I guess I have to somehow point the path of python to version 3.9?
Can somebody help me to fix this?
Try which python3.9 to definitively determine if and where Python 3.9 lives on your path. Then run python3.9 -m pip install … to ensure that the command gets executed against the Python 3.9 interpreter.
This question already has answers here:
'pip' is not recognized as an internal or external command
(40 answers)
Closed 1 year ago.
pip not working with any followed commands:
pip is not showing anywhere:
It sounds like you may not have pip installed, judging from your pictures. If so type this to check python -m pip --version.
If you don't have it installed, perhaps try python -m pip install.
If you do have pip installed and are trying to install pygame, I suggest trying python -m pip install pygame.
I also found that using python didn't work but replacing it with py did. I did these things (a while ago) in terminal on a windows 10 machine, so my suggestions may not be relevant.
This question already has answers here:
Use different Python version with virtualenv
(41 answers)
Closed 4 years ago.
On my osx machine I have python 2.7.15 running.
When I run virtualenv, activate the env, and check the python version, i get 2.7.10.
$> virtualenv env
Unfortunately, I really need version 2.7.15. I tried to specify the virtualenv version by adding the path to /usr/bin/python2.7, but it still creates an env using python 2.7.10.
Any idea how I can set up the version more specifically ?
Similar question: With Python 2.7.15 on a MAC console, virtualenv creates an environment with a different version of Python
SOLVED:
This question solves it but maybe the phrasing of the question was too specific. It solved my issue though. With Python 2.7.15 on a MAC console, virtualenv creates an environment with a different version of Python
Maybe keep this one open for more visibility? It's not about choosing the version, it's about finding where the sub-version (e.g., 2.7.10 or 2.7.15, etc.) is located on the machine. Obviously passing the python interpreter as command line was tried before posting to Stack Overflow.
The trick is that virtualenv uses the python version used to install virtualenv, not the one currently running. Therefore its a matter of finding the right version on your machine.
The python subversion can be located here:
/usr/local/Cellar/python#2/2.7.15/bin/python
You can therefore create virtualenv like this
virtualenv -p /usr/local/Cellar/python#2/2.7.15/bin/python
When you define your virtual environment you should attach a version of python to that environment. See my comment above if you are using anaconda. So when you create your virtual environment be sure to put the exact version of python. For example use 2.7.15 instead of 2.7
You can try pyenv, where you can install as many Python versions as you want. First you need to install Homebrew:
$ brew update
$ brew install pyenv, pyenv-virtualenv
$ pyenv install 2.7.15
$ pyenv virtualenv 2.7.15 my-virtualenv
$ pyenv activate my-virtualenv
This question already has answers here:
How to install pip with Python 3?
(23 answers)
Closed 5 years ago.
I have just downloaded the python 3.4 source from the web site and compiled it with ./configure and make. I get a fully functional python.
Everyone says that pip comes embedded with python but that is not true if I compile it from source.
On a console I do:
./python -m pip install numpy
from the compilation folder, and I get:
No module named pip
I am on a RHEL7 system and I want to produce a standalone python folder with all the needed modules. My intention is to ship this python folder along with some python software so that I am sure that everything is ok. (Not to rely on others installing all the packages that are needed on a fresh RHEL7 installation)
Instead of pip try pip3. It is python version 3.x and appropriate one for it is pip3 I guess.
This question already has answers here:
Modules between multiple versions of Python Linux
(2 answers)
Closed 8 years ago.
I have 2 versions of python 2.7 and 3.3. I installed virtualenv hoping that I can work using two different python version.
I created my first project environment:
/usr/local/bin/virtualenv -p /usr/local/bin/python2.7 first
and installed pymysql package which is available to that environment only.
Now I want the same package to be available globally - how can I do that?
When I run pip install without setting the environment it actually installs in 3.3 version site packages which eventually fails as it is compatible for 2.7?
To have packages available globally you must install them globally. virtualenv is made specifically for making separate package installations. It doesn't provide anything else so I have no idea why are you using it.
You don't need to use virtualenv to have two Python version installed. In fact, virtualenv doesn't help with that at all. Virtualenv is to install several installs of the same Python version.
So to have two different versions of Python installed you simply just install two different versions of Python. It's that simple.
http://regebro.wordpress.com/2011/02/02/newbie-hint-on-installing-python-and-its-modules-and-packages/