Ошибка импорта: нет модуля с именем numpy
У меня очень похожий вопрос к этот вопрос, но все еще на шаг позади. У меня есть только одна версия Python 3, установленная на моем Windows 7 (жаль) 64-разрядная система.
Я установил numpy после этого ссылке — как предложено в вопросе. Установка прошла нормально, но когда я выполняю
Я получил следующую ошибку:
ошибка импорта: нет модуль с именем и NumPy
Я знаю, что это, вероятно, супер основной вопрос, но я все еще учусь.
15 ответов
поддержка Python 3 была добавлена в NumPy версии 1.5.0, поэтому для начала вы должны загрузить / установить более новую версию NumPy.
Вы можете просто использовать
или для python3 используйте
Я думаю, что что-то не так с установкой numpy. Вот мои шаги, чтобы решить эту проблему.
- зайти на этот сайт, чтобы скачать нужный пакет: http://sourceforge.net/projects/numpy/files/
- распаковать пакет
- перейти к документу
- используйте эту команду для установки numpy: python setup.py install
У меня также была эта проблема (ошибка импорта: нет модуля с именем numpy), но в моем случае это была проблема с моими переменными пути в Mac OS X. Я сделал более раннее редактирование моего .bash_profile файл, который вызвал пути для моей установки Anaconda (и другие), чтобы не быть добавлены должным образом.
просто добавьте этот комментарий в список здесь, если другие люди, как я, приходят на эту страницу с тем же сообщением об ошибке и имеют ту же проблему, что и я.
вы установили версию Numpy для Python 2.6-поэтому вы можете использовать ее только с Python 2.6. Вы должны установить Numpy для Python 3.x, например: http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/numpy-1.6.1-win32-superpack-python3.2.exe/download
У меня тоже была эта проблема после установки Numpy. Я решил это, просто закрыв интерпретатор Python и снова открыв его. Если у кого-то еще есть эта проблема, возможно, это сэкономит несколько минут!
1) пожалуйста, установите numpy через командную строку (в windows) 2)Перейдите в папку Scripts и введите следующую команду
C:\Python27\Scripts>pip установить numpy
установка начинается как ниже: Сбор и NumPy Скачивание numpy-1.13.3-2-cp27-none-win32.whl (6,7 МБ) 100% |################################| 6.7 Мб 112кб/с Установка собранных пакетов: numpy Успешно установлен numpy-1.13.3
Я не уверен, почему я получаю эту ошибку, но pip3 uninstall numpy затем pip3 install numpy решил проблему для меня.
для установки NumPy через Anaconda (используйте команды ниже):
- conda install — c conda-forge numpy
- conda install — c conda-forge / этикетка / сломанный numpy
Я тоже столкнулся с вышеуказанной проблемой с phyton 3 при настройке python для машинного обучения.
я следовал приведенным ниже шагам : —
установить python-2.7.13.компания MSI
загружено: — — numpy-1.13.1 + mkl-cp27-cp27m-win32.whl
установки numpy: очко установите numpy-1.13.1+mkl-cp27-cp27m-win32.whl
установка scipy: pip установить scipy-0.18.0-cp27-cp27m-win32.whl
вы можете проверить правильность, используя ниже cmds: —
это проблема версии numpy, пожалуйста, проверьте $CAFFE_ROOT / python / требование.формат txt. Затем exec: sudo apt-get install python-numpy>=x.X. x, эта проблема будет sloved.
те, кто использует xonsh , do xpip install numpy .
Я получил это, хотя я знал, что numpy был установлен и безуспешно пробовал все советы выше. Исправление для меня было удалить как np и непосредственно обратитесь к модулям . (python 3.4.8 на Centos) .
попробовав много предложений с разных сайтов и подобных вопросов, мне удалось удалить все материалы Python и переустановить только Anaconda (см. https://stackoverflow.com/a/38330088/1083292)
предыдущая установка Python у меня была не только избыточной, но и вызвала у меня проблемы.
Источник
Import Error: No module named numpy
I have a very similar question to this question, but still one step behind. I have only one version of Python 3 installed on my Windows 7 (sorry) 64-bit system.
I installed numpy following this link — as suggested in the question. The installation went fine but when I execute
I got the following error:
Import error: No module named numpy
I know this is probably a super basic question, but I’m still learning.
29 Answers 29
You can simply use
Or for python3, use
Support for Python 3 was added in NumPy version 1.5.0, so to begin with, you must download/install a newer version of NumPy.
Or simply using pip :
Installing Numpy on Windows
- Open Windows command prompt with administrator privileges (quick method: Press the Windows key. Type «cmd». Right-click on the suggested «Command Prompt» and select «Run as Administrator)
- Navigate to the Python installation directory’s Scripts folder using the «cd» (change directory) command. e.g. «cd C:\Program Files (x86)\PythonXX\Scripts»
This might be: C:\Users\\AppData\Local\Programs\Python\PythonXX\Scripts or C:\Program Files (x86)\PythonXX\Scripts (where XX represents the Python version number), depending on where it was installed. It may be easier to find the folder using Windows explorer, and then paste or type the address from the Explorer address bar into the command prompt.
- Enter the following command: «pip install numpy».
You should see something similar to the following text appear as the package is downloaded and installed.
Источник
Python3 — ModuleNotFoundError: No module named ‘numpy’
I thought I did not have numpy installed, so I tried to install it:
What? Can anybody tell me how to fix this? I’m using windows 10 64 bits.
2 Answers 2
Your problem is that you installed two different Pythons, a 32-bit 3.6, and a 64-bit 3.6.
The first pip on your PATH is the one for the 32-bit 3.6. So, when you pip install numpy , it’s downloading the 32-bit NumPy, and installing into the site-packages for the 32-bit Python.
But your py launcher is defaulting to running the 64-bit 3.6, which can’t see the site-packages for a completely different Python installation, and couldn’t use them even if it did see them.
The simplest solution is to start over from scratch: Uninstall both Pythons, pick the one you want, and reinstall that. (You could just uninstall the one you don’t want, leaving the other… but that may cause problems, like leaving py configured wrong so it can’t run Python at all. At the very least you should re-run the installer for the one you want to keep and tell it to update the existing installation.)
If you can’t do that, you may want to consider using virtual environments. With a virtual environment active, pip , python and py will all come from the active environment, so it doesn’t matter what else you have anywhere on your system.
If you can’t do that, just don’t run pip , run py -m pip . This guarantees that you’re using the pip for the right Python installation, and installing packages for that installation. (And the same goes for other tools—run py -m 2to3 , not 2to3 , and so on.)
Источник
Python 3 ModuleNotFoundError: No module named ‘numpy’
I trying to run a program in python 3 that uses numpy but it gives me the error ModuleNotFoundError: No module named ‘numpy’ . I am using Windows 10. I tried running pip install numpy and it says pip is not a recognized command
2 Answers 2
Add «way to folder with your python interpreter» and «way to folder with your python interpreter»\Scripts\ to PATH variable. Computer -> Properties -> Extra options -> Environment variables.
You need to add python to your environment variables
- Computer -> System Properties (or Win+Break ) -> Advanced System Settings
- Click the Environment variables button (in the Advanced tab)
- Edit PATH and append ;C:\Python27 to the end (if you need substitute your Python version)
- Click OK. Note that changes to the PATH are only reflected in command prompts opened after the change took place.
If you are running python 3.6 you will need to add python to your environment path through command prompt
Windows allows environment variables to be configured permanently at both the User level and the System level, or temporarily in a command prompt.
To temporarily set environment variables, open Command Prompt and use the set command:
These changes will apply to any further commands executed in that console and will be inherited by any applications started from the console.
To change System variables, you need non-restricted access to your machine (i.e. Administrator rights).
If you were to run python -v it should now work
This came directly from the python documents section 3.3.1
Now after you restart you should be able to access python through the command line. If you are running 2.7.9+ or 3.4+ pip will come prepackaged with python. However, if you are running an earlier version of python
Источник
No module named numpy
I am trying to run Jupyter notebook from my Ubuntu subsystem in Windows 10. I’ve installed numpy, scipy, and pandas using the following commands:
When I load python in Ubuntu, there is no issue importing numpy in Ubuntu cmd.
But, when I run my Jupyter Notebook from Ubuntu terminal, and try to import numpy as np, or import pandas as pd, they report
Is there anyway to solve this issue? Thanks a lot.
3 Answers 3
Every python version get its own environment and modules, so a modules installed for python3.x it is not available to python2.x
Also keep in mind that python get also virtual environment and as per before described the modules and libraries installed in a python3 virtual env are not available in to another virtual environment or in the python3 system installation.
To avoid this situation you can use requirements.txt file and install with pip the necessary modules and libraries needed by your app. an requirements.txt files example:
and install modules with:
this will install panda and numpy at the latest version, if you want to install them to a specific version create the requirements.txt file like this:
the first install numpy exactly at the provided version, the second install panda at any version is major than 2.5 and the last one install math in a version between the provided.
NOTE: (the software version could not match with the real version)
Источник