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, 7 months ago Modified 2 years, 7 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 206k32 gold badges300 silver badges476 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 8,9411 gold badge7 silver badges23 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
- We'll Be In Touch - A New Podcast From Stack Overflow!
- The app that fights for your data privacy rights
- Featured on Meta
- More network sites to see advertising test
- We’re (finally!) going to the cloud!
- Call for testers for an early access release of a Stack Overflow extension...
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
- USB drives in space?
- Accusative with Adverbial Function
- A linked list in C, as generic and modular as possible, for my personal util library
- When was Superman controlled by rock music?
- How far above a forest fire or conflagration would you need to be, to not burn alive?
- Can the same arguments used to reject metaphysical solipsism also support accepting the existence of God?
- How does an Artificer replace a homunculus servant that dies?
- Conflict between fontspec and libertinust1math
- Constrained optimization problem
- WoL across subnets
- Cashless visit to Schengen countries using USA credit card
- To “digitize” means to turn something into a digital format that was previously not digital. What to call changing one digital format into another?
- Does a matrix C exist so that AC and BC are positive definite?
- Adding wireless switch to existing 3-way wired system
- Can radio act as check box, allow deselection?
- Commuting powers of matrices
- How complex is the God of Classical Theism?
- What are the reasons to use a downward vertical stabilizer?
- Are there three distinct Pythagorean triples on six integers?
- 2 gates and three guards
- How to create a thesis flowchart using Mathematica?
- Why do telescopes converge light instead of diverge?
- New 90 TB/10 drive RAID 5 array state: clean, degraded, recovering. Why, and how long will it take to recover?
- Is there a well-known digital logic circuit that outputs the last valid input on a high impedence input?
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.