无法使用pip安装NumPy并导入它

时间:2018-05-11 18:42:28

标签: python python-3.x numpy

我实际上是在ssh上使用Matplotlib和Numpy作为Python脚本。

我必须在我的ssh帐户上创建一个虚拟的python3环境。

然后,我做了:OK

一切运作良好:

pip3 install numpy

pip3 show numpy

Collecting numpy
  Using cached https://files.pythonhosted.org/packages/7b/61/11b05cc37ccdaabad89f04dbdc2a02905cf6de6f9b05816dba843beed328/numpy-1.14.3-cp35-cp35m-manylinux1_x86_64.whl
Installing collected packages: numpy
Successfully installed numpy-1.14.3

然后,在我的剧本中,我把PYTHONPATH这样:

Name: numpy
Version: 1.14.3
Summary: NumPy: array processing for numbers, strings, records, and objects.
Home-page: http://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: /panhome/me/.local/lib/python3.5/site-packages

但实际上我收到以下错误:

export PYTHONPATH=$PYTHONPATH:/panhome/me/.local/lib/python3.5/site-packages

我已经尝试过unistall numpy并重复几次。

感谢您的帮助。

Traceback (most recent call last):
  File "/pandata/me/LEPIWASP/blast_database/public_scripts-master/Diamond_BLAST_add_taxonomic_info/Diamond_blast_to_taxid.py", line 25, in <module>
    import matplotlib
  File "/panhome/me/.local/lib/python3.5/site-packages/matplotlib/__init__.py", line 127, in <module>
    from . import cbook
  File "/panhome/me/.local/lib/python3.5/site-packages/matplotlib/cbook/__init__.py", line 35, in <module>
    import numpy as np
  File "/panhome/me/.local/lib/python3.5/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/panhome/me/.local/lib/python3.5/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/panhome/me/.local/lib/python3.5/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/panhome/me/.local/lib/python3.5/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/panhome/me/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 26, in <module>
    raise ImportError(msg)
ImportError: 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: cannot import name multiarray

这是我运行该过程的脚本:

Import command line in the script file: 
# imports
from __future__ import print_function
import time
import os
import sys
from optparse import OptionParser  # TODO: update to argparser
import datetime
import logging
import logging.handlers
import matplotlib
# this code added to prevent this error:
# self.tk = _tkinter.create(screenName, baseName,
# className, interactive, wantobjects, useTk, sync, use)
# _tkinter.TclError: no display name and
# no $DISPLAY environment variable
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pylab

0 个答案:

没有答案