Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
642 views
in Technique[技术] by (71.8m points)

Install numpy for Python 3.7 in Ubuntu 18.04

I'm having trouble installing numpy on Ubuntu 18.04 for Python 3.7... here's what I tried:

(venv) root@servername:/path$ pip3.7 install numpy --no-cache-dir
Collecting numpy
  Downloading numpy-1.19.5-cp37-cp37m-manylinux2010_x86_64.whl (14.8 MB)
     |████████████████████████████████| 14.8 MB 8.6 MB/s 
Installing collected packages: numpy
Successfully installed numpy-1.19.5

I get this ImportError:

Original error was: No module named 'numpy.core._multiarray_umath'

... but I've been focusing on this as the probable cause, from that same error message:

* The Python version is: Python3.6 from "/path/venv/bin/python"

... that says Python 3.6, but I'm trying to use Python3.7, and that python is on 3.7:

(venv) root@servername:/path$ /path/venv/bin/python --version
Python 3.7.9

I saw in another answer that upgrading can help, so I tried this - it looks like I'm already on the latest:

(venv) root@servername:/path$ pip install numpy --upgrade
Requirement already satisfied: numpy in ./venv/lib/python3.7/site-packages (1.19.5)

How can I get this working?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This was failing for me while using mod-wsgi with Apache - I had to load mod-wsgi for Python 3.7 instead of the system default of 3.6. The instructions are at https://github.com/GrahamDumpleton/mod_wsgi/issues/467, but in case that goes away:

  1. Using your venv, run "mod_wsgi-express module-config"
  2. Put the resulting load command into your apache's mods-enabled/wsgi.load

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...