I'm trying to use pip to install a program specifically to python 3.6.4, but when I run
py -3.6 -m pip install package
It installs to 3.6.1
However, if I try to specify the specific version of 3.6 I want with
py -3.6.4 -m pip install package
It returns this output
Unknown option: -3
I'm guessing the argument for the version does not allow for the second period or something, but does someone else know a way to get around this? I'd prefer to do this without uninstalling 3.6.1
You can use pyenv
You should isntall pyenv and run these command
pyenv install 3.6.4
pyenv global 3.6.4
python -m pip install package
Related
I'm trying to make a pip install of the fastf1 library. I noticed that I was using py 3.7 and that lib requires 3.8 or superior. I updated my interpreter (to python 3.10) but, the pip install keeps returning "ERROR: Could not find a version that satisfies the requirement fastf1". My python --version returns 3.10, but my pip version, although updated, still calling the anaconda's pip
How do I change the main pip to be used in this project?
Terminal result:
PS C:\Users...\Github\speedmetrica\DataAnalysis> python --version
Python 3.10.0
PS C:\Users...\Github\speedmetrica\DataAnalysis> pip --version
pip 21.3.1 from c:\users\jgbal\anaconda3\lib\site-packages\pip (python 3.7)
If python --version is running the desired version of Python, instead of running:
pip install packagename
run:
python -mpip install packagename
That runs the pip module installed for that version of Python as the entry point using the same Python executable you've been running, so it will install for that version of Python as well.
If you're on Windows, and installed as admin to install the Python launcher for Windows, you can be avoid relying on the PATH having a specific version appear first by running:
py -3 -mpip install packagename
which will run the latest installed version of Python 3. Changing to:
py -3.10 -mpip install packagename
will force it to run the latest installed copy of Python 3.10 specifically.
I'm now currently using Python on Ubuntu 15.10.
But in my OS, I have many different python versions installed:
Python (2.7.9)
Python3 (3.4.3)
Python3.5
PyPy
So, it got messy with the versions of the packages in different environments. For example, if I run:
pip3 install django
But in fact, I cannot import django inside python3.5.
Is there any efficient way to call the correct version of pip?
Note:
Don't suggest that I use virtualenv, I know about it and am seeking another solution.
Finally I found the solution myself, see the Docs:
https://docs.python.org/3/installing/index.html?highlight=pip#work-with-multiple-versions-of-python-installed-in-parallel
Just call:
pythonXX -m pip install SomePackage
That would work separately for each version of installed python.
Also, according to the docs, if we want to do the same thing in windows, the command is a bit different:
py -2 -m pip install SomePackage # default Python 2
py -2.7 -m pip install SomePackage # specifically Python 2.7
py -3 -m pip install SomePackage # default Python 3
py -3.4 -m pip install SomePackage # specifically Python 3.4
How about using pyenv?
You can switch the version.
$ pyenv install 2.7.X
$ pyenv install 3.5.X
$ pyenv local 2.7.X
$ pyenv global 3.5.X
This solution worked for me:
sudo python2.7 -m pip install [package name]
Why not using anaconda?
If you use conda, you can easily create/manage virtual env. For example, if you have root env python 3.4 and py27 env for python 2.7, you can easily switch between them use command source activate [env]
source activate py27
conda install SomePackage
So my problem is that I have two versions of python: 2.7 and 3.2. I want to install pycrypto on the 2.7 one but when I try to do this:
python2.7 pip install pcrypto
Or:
pip2.7 install pycrypto
It says that python2.7 or pip2.7 is not a recognized command.
What should I do?
pip installs a library for any version of Python 2
pip3 installs a library for any version of Python 3
On linux terminal, type:
whereis pip
It will print all available paths to pip installations. Copy-paste the full path to the desired pip, e.g.:
/usr/local/bin/pip2.7 install pcrypto
If you want to use pip of a specific python interpreter you can use this interpreter with the -m option to use the specific pip.
python -m pip ...
... should be replaced with the desired pip commands.
The -m option allows to run a library module as a script (in this case the associated pip)
I'm trying to install Python-Twitch for Python 3.4. I have both 3.4 and 3.5 installed on my computer, and in command prompt I do this:
python --version
Where it gives me Python 3.5.x. Then:
set PATH=C:\Python34\;%PATH%
And python --version will then read Python 3.4.x.
Once I do 'pip install python-twitch', it installs it to the Python 3.5 Lib/Site-Packages folder. How would I get this over to 3.4?
Thanks so much for any help.
I think this was already answered: pip: dealing with multiple Python versions?
Since version 0.8, Pip supports pip-{version}. You can use it the same as easy_install-{version}:
$ pip-2.5 install myfoopackage
$ pip-2.6 install otherpackage
$ pip-2.7 install mybarpackage
EDIT: pip changed its schema to use pipVERSION instead of pip-VERSION in version 1.5. You should use the following if you have pip >= 1.5:
$ pip2.6 install otherpackage
$ pip2.7 install mybarpackage
Check https://github.com/pypa/pip/pull/1053 for more details
I am on shared hosting and I need to install pip with the correct python version, 2.7. To install pip, I did:
$ easy_install pip
However, after it was installed I get the following:
[dave#web1 lib]$ pip --version
pip 1.0.2 from /home/premiere/dave/financials/lib/pip-1.0.2-py2.7.egg (python 2.4)
How would I re-install pip to work on the python2.7 version, which is also installed on the machine?
[premiered#web1 ~]$ python --version
Python 2.6.6
Which is strange, since it is installing to python2.4.
You may want to create a virtualenv using -p /path/to/python-2.7.binary param, and then activate it. Then all stuff you installed using pip would be correctly into your virtualenv.
If multiple versions of python are installed on the system, then you should invoke the version you want when installing. i.e.
$ python27 easy_install pip
This creates a pip file in your path that contains the specified version of python in the hashBang line.