สำหรับนักพัฒนาโปรแกรมหรือระบบต่างๆ ด้วยภาษา python อาจจะมีปัญหาในติดตั้ง library หรือ package ที่เราติดตั้งเพิ่มเติมตอนนำขึ้น server demo หรือ server ที่ใช้จริง มี Packages ตัวอาจจะช่วยในปัญหานี้ได้ คือ pipreqs ขั้นตอนมีดังนี้

ทำการติดตั้ง package pipreqs ลงในเครื่องก่อนโดยใช้คำสั่งนี้

pip install pipreqs

ผลจากการติดตั้ง

ผลการติดตั้ง pipreqs

จะมีรูปแบบการใช้งานของ command ดังนี้

Usage:
    pipreqs [options] <path>

Options:
    --use-local           Use ONLY local package info instead of querying PyPI
    --pypi-server <url>   Use custom PyPi server
    --proxy <url>         Use Proxy, parameter will be passed to requests library. You can also just set the
                          environments parameter in your terminal:
                          $ export HTTP_PROXY="http://10.10.1.10:3128"
                          $ export HTTPS_PROXY="https://10.10.1.10:1080"
    --debug               Print debug information
    --ignore <dirs>...    Ignore extra directories, each separated by a comma
    --encoding <charset>  Use encoding parameter for file open
    --savepath <file>     Save the list of requirements in the given file
    --print               Output the list of requirements in the standard output
    --force               Overwrite existing requirements.txt
    --diff <file>         Compare modules in requirements.txt to project imports.
    --clean <file>        Clean up requirements.txt by removing modules that are not imported in project

ตัวอย่างการใช้งานมีดังนี้

pipreqs --use-local ./

ผลจาการรันคำสั่ง

ผลการรันคำสั่ง

จากนั้นก็จะได้ไฟล์ requirements.txt มาอยู่ในโปรแกรม

ไฟล์ requirement

ภายในไฟล์นั้นก็จะมีพวกชื่อ package ที่เราได้ทำการติดตั้งภายในโปรแกรม

ภายในของไฟล์ requirents.txt

อันนี้ก็เป็น package ในไฟล์ python ที่ได้ import มาใช้งาน

package ในไฟล์ python ที่ import

 

อ้างอิง
https://www.pypi.org/project/pipreqs/
https://www.dev.to/bhupesh/pipreqs-automatically-generate-python-dependencies-30nl
https://www.github.com/bndr/pipreqs

กระทู้ล่าสุดจากเว็บบอร์ด
หัวข้อกระทู้
ตอบ
เปิดดู
ล่าสุด
ตั้งชื่อใหม่ ให้ php class.upload. php_class_upload_download
โดย mindphp อ 23 มิ.ย. 2009 9:02 pm บอร์ด Free PHP Code Download script
2
8418
อ 15 ม.ค. 2012 1:29 pm โดย darknight View Topic ตั้งชื่อใหม่ ให้ php class.upload. php_class_upload_download
จาวาแรนดอมแอดไอเฟรมผิดตรงไหนครับ
โดย gamara13 อ 23 มิ.ย. 2009 8:32 pm บอร์ด JavaScript & jQuery Ajax & Node.JS
1
1643
จ 29 มิ.ย. 2009 8:18 am โดย niponnet View Topic จาวาแรนดอมแอดไอเฟรมผิดตรงไหนครับ
function empty กับ function trim ไม่สามารถใช้ร่วมกันได้นะ
โดย mindphp อ 23 มิ.ย. 2009 6:53 pm บอร์ด Free PHP Code Download script
0
1794
อ 23 มิ.ย. 2009 6:53 pm โดย mindphp View Topic function empty กับ function trim ไม่สามารถใช้ร่วมกันได้นะ
เช้าหน้า localhost ช้าจังครับ
โดย unknowszaa อ 23 มิ.ย. 2009 3:58 pm บอร์ด Programming - PHP
4
3423
ศ 08 เม.ย. 2011 7:40 pm โดย บุคคลทั่วไป View Topic เช้าหน้า localhost ช้าจังครับ
install -ข้นคำว่า Restricted access
โดย anurat อ 23 มิ.ย. 2009 11:20 am บอร์ด สอบถามปัญหาการใช้ phpBB3, SMF, Joomla, Wordpress, CMS, CRM
5
2106
อ 23 มิ.ย. 2009 2:34 pm โดย mindphp View Topic install -ข้นคำว่า Restricted access
สอบถามเรื่องทำกราฟ ด้วย FusionCharts นำเข้าด้วย xml
โดย sudterak_npb จ 22 มิ.ย. 2009 4:44 pm บอร์ด Programming - PHP
2
3058
พ 24 มิ.ย. 2009 3:34 pm โดย secivon View Topic สอบถามเรื่องทำกราฟ ด้วย FusionCharts นำเข้าด้วย xml
แก้ปัญหา Error SAFE MODE Restriction in effect.
โดย mindphp จ 22 มิ.ย. 2009 12:25 pm บอร์ด Programming - PHP
0
1154
จ 22 มิ.ย. 2009 12:25 pm โดย mindphp View Topic แก้ปัญหา Error SAFE MODE Restriction in effect.
ขอถามเรื่อง<meta name=ProgId content=Excel.Sheet> คืออะไรค่ะ
โดย ammyamm จ 22 มิ.ย. 2009 9:35 am บอร์ด Programming - PHP
1
1398
จ 22 มิ.ย. 2009 2:11 pm โดย mindphp View Topic ขอถามเรื่อง<meta name=ProgId content=Excel.Sheet> คืออะไรค่ะ