Python is a good thing,Many times we like to use it to write small things... For example, many services on my server are written in Python ( Supervisor will use your Python program becomes Services ),Accumulate,Many dependency packages are actually used。
but,These Python dependencies will not follow your apt upgrade to update,Today, after a long time,I found a package I am using,Has been updated to 1.10.x,but me,Still using 0.4...
In short,Python's own package manager does not provide a convenient command like apt upgrade Update all packages with one click,We have to think of another way。
One-line command update method
Some articles on the Internet use a complex command to update,The principle is to read pip3 list --outdated (Ironically, pip gives a list of expired packages,But it doesn’t allow you to upgrade them with one click) and then input the result to pip3 install -The ,This scheme is not so stable,Maybe a master who is proficient in shell can use it freely.,I will not provide specific code,Because everyone’s realization is a little different。
Update using pip-review
Don't use the requirements below,Not easy to use,Use pip-review to set and select the dependent packages to be updated one by one,Then batch update,Convenient。
1 |
$ pip3 install pip-review |
After installing pip-review,Use the following command to use:
1 |
python3 -m pip_review --local --interactive |
use
requirements
Is there a more simple and understandable update plan? The answer is yes。
The requirement file is used to solve the one-click configuration environment dependency of Python package distribution,We can also print out the global environment,Then import it in an updated form,Such,The global update is done!
1 |
<del>pip3 freeze > requirements.txt</del> |
First export global dependencies-that is, all installed packages。
1 |
<del>pip3 install -r requirements.txt --upgrade</del> |
Now we "install" these packages back,But to
upgrade ……carry out!
Original article written by LogStudio:R0uter's Blog » Quickly update Python packages
Reproduced Please keep the source and description link:https://www.logcg.com/archives/3466.html
Pipenv and pyenv have been used in recent years,Not to mention the frequent pyenv bugs,pipenv does solve some problems,Can try
The boss’s operation was very nasty and then it exploded
How come...upgrade a shuttle!
The big guy is indeed a big guy! Not afraid of overturning!
If something goes wrong, you can debug it on the spot... Anyway, there are not many users,Besides, lts is quite stable now~
There are not many users anyway,It took a few days to find out 😂...
hhhh I only know when someone comes to the door~