PyInquirer
PyInquirer copied to clipboard
ModuleNotFoundError: PyInquirer Not Detected in Virtual Environment
I'm encountering a ModuleNotFoundError when trying to run my Python script that imports PyInquirer. Despite having PyInquirer installed in my virtual environment, the script fails to recognize the module.
The error mesage is:
Traceback (most recent call last):
File "[Censored]", line 3, in
note: PyInquirer is correctly installed within the virtual environment. Python version: 3.12 Operating System: windows IDEs tested: vs code, pycharm The appropriate Python interpreter from the virtual environment is selected
I'm encountering a ModuleNotFoundError when trying to run my Python script that imports PyInquirer. Despite having PyInquirer installed in my virtual environment, the script fails to recognize the module.
The error mesage is: Traceback (most recent call last): File "[Censored]", line 3, in import PyInquirer as Inquirer ModuleNotFoundError: No module named 'PyInquirer'
note: PyInquirer is correctly installed within the virtual environment. Python version: 3.12 Operating System: windows IDEs tested: vs code, pycharm The appropriate Python interpreter from the virtual environment is selected
Make sure that the script is using the correct Python interpreter associated with your virtual environment.
You can try the following :
-
Activate Your Virtual Environment: Ensure that the virtual environment where you installed
PyInquireris activated in the terminal where you're running the script. You can activate it by running:source path_to_your_env/Scripts/activate # On WindowsAfter activation, you should see the virtual environment name in your terminal prompt.
-
Verify the Package Installation: With the virtual environment activated, check if
PyInquireris installed by running:pip listor
pip show PyInquirerIf
PyInquirershows up in the list, it’s installed correctly. If it doesn't, you might need to reinstall it usingpip install PyInquirer. -
Check Your IDE Settings:
Since you're using VS Code and PyCharm, make sure that both are configured to use the Python interpreter from your virtual environment.
In VS Code, you can check this by looking at the Python version displayed in the bottom-left corner of the window.
In PyCharm, you can verify this in the project settings under "Python Interpreter."