i was working with python 3.7 and i installed recently python 3.8 in linux.
Is there any bash command or script that take a list of all packages of 3.7 and install it one by one in 3.8 version.
i want to avoid to do it by hand every package.
Note: i install them in my system not using venv.
Thanks!
/path_to_3.7_bin/python -m pip freeze > /home/packages_list.txt
then
/path_to_3.8_bin/python -m pip install -r /home/packages_list.txt
try https://pip.pypa.io/en/stable/reference/pip_freeze/
pip freeze > requirements.pip in the old version
pip install -r requirements.pip in the new version
Related
I have two versions of python installed on my computer (3.6 and 3.7). Just upgraded pip to the latest version (19.0.1) using the command python -m pip install --upgrade pip however i think it only upgraded the pip for python version 3.6. When attempting to install a package specifically for python version 3.7 with the following command pip3.7 install scipy i got the message saying You are using pip version 18.1, however version 19.0.1 is available. Clearly only the pip for version 3.6 was upgraded. I cannot figure out a command to upgrade 3.7 pip as well. I tried the following:
python -m pip3.7 install --upgrade pip
This did not work (Trying to use the logic of how packages are handled for different versions of python). Could not find a question that addressed this specific issue. Any help would be greatly appreciated.
Use the python 3.7 interpreter to run the command:
python3.7 -m pip install --upgrade pip
Or use the pip3.7 binary directly:
pip3.7 install --upgrade pip
export LD_LIBRARY_PATH=/usr/lib64
activate pip3
I ran into the same problem. If you have Microsoft Visual also installed the best command to use is
py -m pip install --upgrade pip --user
I used that command, and it worked like a charm.
I have my deployment system running CentOS 6.
It has by default python 2.6.6 installed. So, "which python" gives me /usr/bin/python (which is 2.6.6)
I later installed python3.5, which is invoked as python3 ("which python3" gives me /usr/local/bin/python3)
Using pip, I need to install a few packages that are specific to python3. So I did pip install using:-
"sudo yum install python-pip"
So "which pip" is /usr/bin/pip.
Now whenever I do any "pip install", it just installs it for 2.6.6. :-(
It is clear that pip installation got tied to python 2.6.6 and invoking pip later, only installs packages for 2.6.6.
How can I get around this issue?
If pip isn’t already installed, then first try to bootstrap it from the standard library:
$ python3.5 -m ensurepip --default-pip
If that still doesn’t allow you to run pip:
Securely Download get-pip.py.
Run sudo python3.5 get-pip.py.
Now you can use pip3 to install packages for python3.5. For example, try:
$ sudo pip3 install ipython # isntall IPython for python3.5
Alternatively, as long as the corresponding pip has been installed, you can use pip for a specific Python version like this:
$ python3.5 -m pip install SomePackage # specifically Python 3.5
References:
Ensure you can run pip from the command line
work with multiple versions of Python installed in parallel?
I have python 3.6 and 3.8 on my Ubuntu 18.04 WSL machine. Running
sudo apt-get install python3-pip
pip3 install my_package_name
kept installing packages into Python 3.6 dist directories. The only way that I could install packages for Python 3.8 was:
python3.8 -m pip install my_package_name
That installed appropriate package into the Python 3.8 dist package directory so that when I ran my code with python3.8, the required package was available.
Example of how to install pip for a specific python version
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
/opt/local/bin/python2.7 get-pip.py
Script is from official doc: https://pip.pypa.io/en/stable/installing/
On Ubuntu 18.04.1 LTS I wanted to install pip for my second python version (python3) and the following command did the trick for me:
$ sudo apt install python3-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 want to install pip for python 2.7, but I am also having python 3.x but both locations are different. when ever I install or update the pip It is installing in the python 3.x location.
How to install pip for python 2.7?
I recently found the following solution, when you are maintaining python2.x and python 3.x in host system. You can find the pip under Scripts folder.
Try pip --version it gives pip version and python version as well
If you want to install package using pip use the following commands.
python -m pip install package_name
python2.x -m pip install package_name
Which reads the specified python pip module to install the package
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.