I have every library installed using pip;
when I write the code, IDE doesn't show any errors; but when I want to run the code, IDE has ImportError for every function;
I think The Problem is sth about my terminal, but I'm not Really Sure.
Go to the "terminal"(for PyCharm)/"console"(for Spyder) of the IDE you are using, and install the packages using pip in that terminal, it should work!
Problem is the packages you have installed using pip is not being mapped to the IDE
Related
I have installed Spyder using pip (after realising that Anaconda gave me issues with my Windows username containing a space).
Pip says it is installed and up to date but if I try to launch it via CMD using "spyder" or "spyder3", cmd does not recognise the command.
I also cannot find it anywhere in the python folder.
This is bizarre, has anyone got any solution?
Thank you
PS I'm running Windows 10 with Python 3.8 and currently use PyCharm
I had a similar problem with pygame and pyinstaller, did you update your paths? Make sure to add C:\Users\YourUsername\AppData\Local\Programs\Python\Python38-32\Scripts
that's where my mine are installed
Hello I have a weird situation where I run my python code from VScode run button, which brings me into Python terminal in VScode, I hvae this error message.
ModuleNotFoundError: No module named 'dotenv'
But if I run the same code in a regular terminal in VScode not Python terminal, I can run the code no error regarding dotenv.
Can you please explain why it is happening?
thank you
Next time, please provide more information, be more clear, and would be better to attach some pictures. Otherwise, it's hard to understand what's your mean, and the people hard to give you suitable suggestions.
I guess the problem you meet just because you run your code with a different environment. The environment which you run across the problem because you haven't installed the 'dotenv' package. It looks like you had installed the package in your global python environment, but you haven't installed the package in your virtual environment. You can add this code in your python file to distinguish which python, which environment you are using:
import sys
print(sys.executable)
If I am right, then you just need to activate your virtual environment(Ctrl+Shift+`), and run the command "pip install dotenv". Before install, you should check which pip you are using, through the command "pip --version". Be sure you had installed the package into your virtual environment.
im very new in programming and i learn Python.
I'm coding on mac btw.
I'd like to know how can i import some modules in VS code.
For exemple, if i want to use the speedtest module i have to download it (what i did) and then import it to my code. But it never worked and i always have the error no module etc.
I used pip to install each package, i have them on my computer but i really don't know to import them on VS code. Even with the terminal of the IDE.
I know it must be something very common for u guys but i will help me a lot.
Thx
Quick Summary
This might not be an issue with VS Code.
Problem: The folder to which pip3 installs your packages is not on your $PATH.
Fix: Go to /Applications/Python 3.8 in Finder, and run the Update Shell Profile.command script. Also, if you are using pip install <package>, instead of pip3 install <package> that might be your problem.
Details
Your Mac looks for installed packages in several different folders on your Mac. The list of folders it searches is stored in an environment variable called $PATH. Paths like /Library/Frameworks/Python.framework/Versions/3.8/bin should be in the $PATH environment variable, since that's where pip3 installs all packages.
Most probably you have multiple versions of python on your computer.
You have to select your python interpreter for which you have installed those packages using pip to do this you'll have to click on the python version you see in the bottom and select the correct interpreter from the list:
You can also find more information within the VSCode docs.
I'm trying to run a program with pynput. I tried installing it through terminal on Mac with pip. However, it still says it's unresolved on my ide PyCharm. Does anyone have any idea of how to install this?
I have three theories, but first: make sure it is installed by running python -c "import pynput"
JetBrain's IDEs typically do not scan for package updates, so try restarting the IDE.
JetBrain's IDE might configure a python environment for you, this might cause you to have to manually import it in your run configuration.
You have two python versions installed and you installed the package on the opposite version you run script on.
I think either 1 or 3 is the most likely.
New to python and I cannot import modules that I have installed via pip.
For instance, I have installed numpy though cannot import it.
I have a feeling from trying to work this out that it is installing to the wrong directory, or I am calling the wrong version.
$ which python
returns
/usr/bin/python
I am just not sure how to change it so I can access the modules.
First if all, you are installing the packages using pip, which means you install it on python 2 by the default configurations.
The issue you are describing can be caused by several problems:
If you are working with an IDE like pycharm- your project interpeter might by python 3.x. You should change it to python 2 since you used pip and not pip3.
Some newer versions of pycharm are opening virtual environment by default in new projects. This means that if you install packages outside the virtual environment you will not be able to access them. When opening a project, intended of applying the default settings, change the interpreter to your system interpreter, probably your python2.7 in your case.
You are not using an IDE but accecing python from your terminal like so: python3 instead of python.
Hope it helps ;)
From a terminal try:
pip install numpy --user
This install numpy to your home directory. Sometimes this helps compared with installing it without the '--user' flag.
Then:
python
Now you have a python command line. Try:
import numpy
If you don't see any error message, then the install worked. Control-d or typing 'exit()' returns you to your shell.