I have python 3.7.2. I am trying to import numpy and keep getting this error. I use the terminal on Mac OS Mojave V 10.14.2
import numpy
Traceback (most recent call last):
File "< stdin >", line 1, in < module >
ModuleNotFoundError: No module named 'numpy'
I think this could be a duplicate of this question.
numpy is not part of the python standard library and needs to be installed separately.
There are instructions for mac install in the question I linked for you.
Related
I'm confused by how I'm supposed to install/use new modules in PythonAnywhere.
For instance, I installed the module ephem in Bash console with
pip3.6 install --user ephem
Everything went alright. If I run the above command again it says;
Looking in links: /usr/share/pip-wheels
Requirement already satisfied: ephem in ./.local/lib/python3.6/site-packages (3.7.7.0)
However, when I try to use it in my script I get:
Traceback (most recent call last): File "/home/krollibrius/montaulieu.py", line 7, in <module> import ephem ModuleNotFoundError: No module named 'ephem'
Can someone help?
Perhaps you used the wrong python version, try adding
import sys
print(sys.version)
to your script. I find that most of the time I install packages to the wrong version.
Another solution could be to use the command pythonwithversionnumber -m pip install --user ephem. Replace pythonwithversionnumber with the command you used to run your script
Is there a way where I can import both opencv2 and rospy successfully in python3. Because right now I get an error.
Traceback (most recent call last): File "", line 1, in ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type
removing the line "source /opt/ros/kinetic/setup.bash" from my bash file solves the problem of importing opencv but now I cant import rospy
This happens since ROS creates its own open cv ,which is compatible with python2 only.To solve this
You need to rename the Cv of Ros located at /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so to something else, example cv_renamed.so and then you should be able to import it
Since Ros cannot coexist for python2 and python3 , It is recommended to have a virtual environment(conda,virtual env)
I'm using Ubuntu 17.04 on Dell Laptop.
I'm trying to install the cloudstorage module.
When installing the module with Python2 using sudo, it works, however on importing it fails:
python storage2.py
Traceback (most recent call last):
File "storage2.py", line 6, in
import cloudstorage as gcs
File "/home/maxim/.local/lib/python2.7/site-packages/cloudstorage/init.py", line 56
def get_driver(driver: DriverName) -> Drivers:
Also, when I try installing this module with Python3 it fails:
https://apaste.info/QKYD
Why the import fails and how to fix it?
How to install this module in Python3?
I used the following command to install mitmproxy rather than using pip
brew install mitmproxy
However when I try to run mitmproxy, I receive the below. What could be the cause for this? Does that mean I have 2 version of six and need to uninstall the outdated?
$ mitmproxy
Traceback (most recent call last):
File "/usr/local/bin/mitmproxy", line 7, in <module>
from mitmproxy.main import mitmproxy
File "/Library/Python/2.7/site-packages/mitmproxy/main.py", line 7, in <module>
from six.moves import _thread # PY3: We only need _thread.error, which is an alias of RuntimeError in 3.3+
ImportError: cannot import name _thread
When compiling libjingle, on running the 'hammer.sh' on the swtoolkit,
i get the following import error,
root#den-pc:~/tejesh/libjingle-0.6.14/talk# sh ../../swtoolkit/hammer.sh
Traceback (most recent call last):
File "../../swtoolkit/wrapper.py", line 44, in <module>
import SCons.Script
ImportError: No module named SCons.Script
so how do i fix this import error... any suggestions?
i already setup the environment variables for scons (SCONS_DIR) and have all the libraries installed..
If you have SCons correctly installed, then it sounds like a problem with python not being able to find it. In addition to the SCONS_DIR environment variable, try including the SCons location in the PYTHONPATH environment variable.
when you install scons,in the README file,you can use:
# python setup.py install --standalone-lib
that can make scons modules into pythonpath.