PIL Module In Python - Visual Studio Code - Stack Overflow
Có thể bạn quan tâm
-
- Home
- Questions
- Tags
- Users
- Companies
- Labs
- Jobs
- Discussions
- Collectives
-
Communities for your favorite technologies. Explore all Collectives
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsGet early access and see previews of new features.
Learn more about Labs PIL module in python Ask Question Asked 2 years, 8 months ago Modified 2 years, 8 months ago Viewed 2k times -3I have no problem running the program with vscode, but when I try to run the program using the terminal, I get the ImportError. And when I want to install the pillow module with the pip install pillow command, the terminal writes that this module> l has already been installed. Does anyone know where the problem is?
Example code:
from PIL import Image img = Image.open('known_d2.png') print(img)1. response From terminal
Traceback (most recent call last): File "pillow_MOUDLE.py", line 1, in from PIL import Image ImportError: No module named PIL
2. response From vscode <PIL.PngImagePlugin.PngImageFile image mode=RGB size=1290x1000 at 0x7F873E855A60>
Share Improve this question Follow edited Apr 22, 2022 at 21:29 Mark Setchell 207k32 gold badges300 silver badges477 bronze badges asked Apr 22, 2022 at 21:10 M.HsHM.HsH 11 bronze badge 3- Install with python -m pip install pillow. This ensures that you're installing to the correct interpreter's path. – Michael Ruth Commented Apr 22, 2022 at 21:18
- @MichaelRuth I see where you're coming from, but not if OP uses python3 ... – Mark Setchell Commented Apr 22, 2022 at 21:26
- @MarkSetchell, yup. In that case OP would need to have aliased python3 as python or know the path to the proper interpreter. Hopefully, OP's VSCode terminal is set up so that the proper interpreter is aliased as python. – Michael Ruth Commented Apr 22, 2022 at 23:32
1 Answer
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 1Because of the import mechanism of python, it can run in the IDE compiler because the compiler has created the project and can identify the modules to be introduced; However, it cannot be recognized on the CMD command line. So there are several solutions
- Add the environment variable pythonpath and add your project address in the variable
- Create in the python installation directory .pth file. The content in the file is your project address.
- For the solution to your current problem, "pip install pillow" in shell can solve it.
Of course, the above is based on the premise that the shell and vsocde use the same interpreter.
Share Improve this answer Follow answered Apr 25, 2022 at 2:42 MingJie-MSFTMingJie-MSFT 9,0291 gold badge8 silver badges24 bronze badges 0 Add a comment |Your Answer
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Draft saved Draft discardedSign up or log in
Sign up using Google Sign up using Email and Password SubmitPost as a guest
Name EmailRequired, but never shown
Post Your Answer DiscardBy clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged
or ask your own question.- The Overflow Blog
- The real 10x developer makes their whole team better
- The ghost jobs haunting your career search
- Featured on Meta
- The December 2024 Community Asks Sprint has been moved to March 2025 (and...
- Stack Overflow Jobs is expanding to more countries
Related
3 Problems using PIL 1.1.7 4 What is going on with PIL and the import statement 0 How to correctly use PIL with Python under windows? 1 PIL Module Error 0 PIL attribute error 38 No Module named PIL 0 python.pil: command not found 1 Unable to import PIL into project 1 python pil module name pronlems 0 trying to import PILHot Network Questions
- B2 Visa Stay Duration Rules
- Determining Which Points on the Perimeter of a Circle Fall Between Two Other Points That Are on Its Radius
- Issues with Implementing Adaptive Step-Size Explicit Runge-Kutta Methods in C for ODE Solvers
- Story about a LLM-ish machine trained on Nebula winners, and published under girlfriend's name
- Is Luke 4:8 enjoining to "worship and serve" or serve only
- How to place a heavy bike on a workstand without lifting
- Is mathematics just "a part of physics", as stated by Arnold in 1997?
- Countable translations of a positive measure set cover an interval?
- Using eigenvalues of an differential operator to numerically solve another differential equation and use the solutions to perform integration
- Sharpness of the Lebesgue differentiation theorem
- CD with physical hole is perfectly readable - how?
- How does Electrum ismine() work?
- How to obtain Cyrillic letters with polyglossia and main font TeX Gyre Pagella?
- How does schedule 7 of the Terrorism Act 2000 interact with the GDPR?
- Elementary consequence of non-abelian class field theory
- Can anyone identify this early biplane from 1920?
- Replacing complex numbers in expressions
- How to calculate standard deviation when only mean of the data, sample size, and t-test is available?
- It's a Wonderful Life Mr. Potter
- What information can I obtain from power spectrum density (PSD) that I can't obtain from Fourier transform of a signal?
- How much influence do the below 3 SCOTUS precedents have for Trump voiding birthright citizenship?
- Why kinetically controlled enolate is not formed?
- Is honey good or bad for kids?
- What ranks did the French Garde National have in 1848?
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-pyTừ khóa » Thư Viện Pil Trong Python
-
Hướng Dẫn Sử Dụng Thư Viện PILLOW để Xử Lý Hình ảnh Trong ...
-
[Python Cơ Bản Thường Dùng Trong Công Việc] Phần 6 : Xử Lý Hình ảnh
-
Giới Thiệu Về Thư Viện Hình ảnh Python - HelpEx
-
Hướng Dẫn Sử Dụng Thư Viện PILLOW để Xử Lý Hình ảnh ... - TungChi'N
-
Xử Lý ảnh đơn Giản Với Lib PIL Của Python
-
Quy Trình Cài Đặt Thư Viện Python3.8 Pil Theo Win10 - Mofun IT
-
Cách Cài Thư Viện Tensorflow, PIL, Pillow, Numpy 2021 "lato' Channel"
-
TOP THƯ VIỆN PYTHON TỐT NHẤT - Hybrid Technologies
-
Xử Lý Hình ảnh Trong Python - GÓC HỌC TẬP
-
PIL định Nghĩa: Thư Viện Hình ảnh Python - Abbreviation Finder
-
Xử Lý Hình ảnh Trong Python: Từ Thuật Toán đến Công Cụ - VinBigData
-
PIL: Mô-đun Xử Lý Hình ảnh được Phát Triển Cho Python - Morioh
-
Chuyển đổi ảnh OpenCV Sang Pillow Và Ngược Lại - Minh Nguyen
-
Cài PIL (Python Imaging Library) Trên Window 64 Bit Và 32 Bit.