How to check the third-party libraries and their versions that a Python script depends on?

WBOY
Release: 2023-04-23 14:40:07
forward
4421 people have browsed it

1. First install the pipreqs library

Use the pip command and use the Douban image. The command is as follows:

pip install pipreqs -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
Copy after login

How to check the third-party libraries and their versions that a Python script depends on?

2. Open Terminal in pycharm

How to check the third-party libraries and their versions that a Python script depends on?

3. In terminal, if you want to view the packages that the script in the test folder depends on, enter the following Command:

pipreqs ./test --encoding=utf8 --force
Copy after login

How to check the third-party libraries and their versions that a Python script depends on?

When INFO: Successfully saved requirements file in ./test\requirements.txt appears, it means the operation is successful

4. In the test folder, you can see that a new requirements.txt file has been created. Open the file to view the packages and versions that the script depends on:

How to check the third-party libraries and their versions that a Python script depends on?

How to check the third-party libraries and their versions that a Python script depends on?

This way you can see the packages and versions that the script depends on

5. If you need to migrate the project to other environments or machines, use the following Method to install dependent packages:

pip install -r requirements.txt -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
Copy after login

How to check the third-party libraries and their versions that a Python script depends on?

The above is the detailed content of How to check the third-party libraries and their versions that a Python script depends on?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template