Reputation: 39
i just downloaded python 3.8.2 and i cant import numpy , i get '''invalid syntax ''' no matter what i try for example i tried :
import numpy
here the output is
ModuleNotFoundError: No module named 'numpy'
now for this code
python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
and
sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
and
sudo dnf install numpy scipy python-matplotlib ipython python-pandas sympy python-nose atlas-devel
i get
SyntaxError: invalid syntax
but no use .
Upvotes: 0
Views: 13641
Reputation: 39
problem solved it turns out that i should have custom installed python , and checked the option of 'Add python to environment variables' now things run smoothly
Upvotes: 0
Reputation: 43505
Since you are using sudo
, you seem to be using a UNIX-like operating system.
On those systems, the python
command may or may not be available, and it may point to Python 2 or Python 3.
Since you get an "invalid syntax" error, I suspect that python
is actually linked to python2
.
If you have installed Python 3.8, the command python3.8
should exist. Use that when trying to install numpy
using setup.py
.
For the same reason, do not call pip <module>
, but use python3.8 -m pip <module>
to ensure it is installed for Python3.8.
When using apt-get
of dnf
, I expect that you have to include the version number in the package names somehow. Check the repository that you're using.
Upvotes: 0