Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python:已成功安装模块,但无法通过导入使用_Python_Module_Pip_Installation - Fatal编程技术网

Python:已成功安装模块,但无法通过导入使用

Python:已成功安装模块,但无法通过导入使用,python,module,pip,installation,Python,Module,Pip,Installation,我正在使用Jupyter笔记本,我想导入一个名为的外部工具箱。由于它目前仅在Python2.7中运行,因此我设置了一个Python2.7内核,如下所述。所以我可以在Jupyter笔记本中将内核更改为python 2。 如果我想使用 import bluepyopt as bpop 我得到了错误 ModuleNotFoundError Traceback (most recent call last) <ipython-input-1-83e46

我正在使用Jupyter笔记本,我想导入一个名为的外部工具箱。由于它目前仅在Python2.7中运行,因此我设置了一个Python2.7内核,如下所述。所以我可以在Jupyter笔记本中将内核更改为python 2。 如果我想使用

import bluepyopt as bpop
我得到了错误

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-83e46e18aae9> in <module>()
      3 
      4 # to create electrical cell models
----> 5 import bluepyopt as bpop
      6 import bluepyopt.ephys as ephys
      7 

ModuleNotFoundError: No module named 'bluepyopt'
这也给了我一个不寻常的超级looooong输出。我不知道这里什么是重要的,所以我将发布所有这些信息以确保安全。这只发生在Python2.7中,然而,在Python3中,一切正常!知道为什么会这样吗

Collecting bluepyopt
Collecting efel>=2.11 (from bluepyopt)
  Using cached efel-2.12.11.tar.gz
Collecting ipyparallel (from bluepyopt)
  Using cached ipyparallel-6.0.2-py2.py3-none-any.whl
Requirement already satisfied: Jinja2>=2.8 in c:\users\alex\anaconda3\lib\site-packages (from bluepyopt)
Requirement already satisfied: pickleshare>=0.7.3 in c:\users\alex\anaconda3\lib\site-packages (from bluepyopt)
Requirement already satisfied: numpy>=1.6 in c:\users\alex\anaconda3\lib\site-packages (from bluepyopt)
Collecting scoop>=0.7 (from bluepyopt)
Requirement already satisfied: pandas>=0.18 in c:\users\alex\anaconda3\lib\site-packages (from bluepyopt)
Collecting future (from bluepyopt)
Requirement already satisfied: deap in c:\users\alex\anaconda3\lib\site-packages (from bluepyopt)
Requirement already satisfied: six in c:\users\alex\anaconda3\lib\site-packages (from efel>=2.11->bluepyopt)
Requirement already satisfied: ipython>=4 in c:\users\alex\anaconda3\lib\site-packages (from ipyparallel->bluepyopt)
Requirement already satisfied: ipykernel in c:\users\alex\anaconda3\lib\site-packages (from ipyparallel->bluepyopt)
Requirement already satisfied: python-dateutil>=2.1 in c:\users\alex\anaconda3\lib\site-packages (from ipyparallel->bluepyopt)
Requirement already satisfied: pyzmq>=13 in c:\users\alex\anaconda3\lib\site-packages (from ipyparallel->bluepyopt)
Requirement already satisfied: tornado>=4 in c:\users\alex\anaconda3\lib\site-packages (from ipyparallel->bluepyopt)
Requirement already satisfied: ipython-genutils in c:\users\alex\anaconda3\lib\site-packages (from ipyparallel->bluepyopt)
Requirement already satisfied: jupyter-client in c:\users\alex\anaconda3\lib\site-packages (from ipyparallel->bluepyopt)
Requirement already satisfied: decorator in c:\users\alex\anaconda3\lib\site-packages (from ipyparallel->bluepyopt)
Requirement already satisfied: MarkupSafe>=0.23 in c:\users\alex\anaconda3\lib\site-packages (from Jinja2>=2.8->bluepyopt)
Requirement already satisfied: greenlet>=0.3.4 in c:\users\alex\anaconda3\lib\site-packages (from scoop>=0.7->bluepyopt)
Collecting argparse>=1.1 (from scoop>=0.7->bluepyopt)
  Using cached argparse-1.4.0-py2.py3-none-any.whl
Requirement already satisfied: pytz>=2011k in c:\users\alex\anaconda3\lib\site-packages (from pandas>=0.18->bluepyopt)
Building wheels for collected packages: efel
  Running setup.py bdist_wheel for efel: started
  Running setup.py bdist_wheel for efel: finished with status 'error'
  Complete output from command C:\Users\Alex\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Alex\\AppData\\Local\\Temp\\pip-build-cygqwlch\\efel\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\Alex\AppData\Local\Temp\tmp5k5lqwx6pip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\efel
  copying efel\api.py -> build\lib.win-amd64-3.6\efel
  copying efel\io.py -> build\lib.win-amd64-3.6\efel
  copying efel\settings.py -> build\lib.win-amd64-3.6\efel
  copying efel\_version.py -> build\lib.win-amd64-3.6\efel
  copying efel\__init__.py -> build\lib.win-amd64-3.6\efel
  copying efel\DependencyV5.txt -> build\lib.win-amd64-3.6\efel
  creating build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\Utils.h -> build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\LibV1.h -> build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\LibV2.h -> build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\LibV3.h -> build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\LibV4.h -> build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\LibV5.h -> build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\FillFptrTable.h -> build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\DependencyTree.h -> build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\efel.h -> build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\cfeature.h -> build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\Global.h -> build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\mapoperations.h -> build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\types.h -> build\lib.win-amd64-3.6\efel\cppcore
  copying efel\cppcore\eFELLogger.h -> build\lib.win-amd64-3.6\efel\cppcore
  UPDATING build\lib.win-amd64-3.6\efel/_version.py
  set build\lib.win-amd64-3.6\efel/_version.py to '2.12.11'
  running build_ext
  building 'efel.cppcore' extension
  error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

  ----------------------------------------
  Running setup.py clean for efel
Failed to build efel
Installing collected packages: efel, ipyparallel, argparse, scoop, future, bluepyopt
  Running setup.py install for efel: started
    Running setup.py install for efel: finished with status 'error'
    Complete output from command C:\Users\Alex\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Alex\\AppData\\Local\\Temp\\pip-build-cygqwlch\\efel\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Alex\AppData\Local\Temp\pip-n69ud86n-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    creating build\lib.win-amd64-3.6\efel
    copying efel\api.py -> build\lib.win-amd64-3.6\efel
    copying efel\io.py -> build\lib.win-amd64-3.6\efel
    copying efel\settings.py -> build\lib.win-amd64-3.6\efel
    copying efel\_version.py -> build\lib.win-amd64-3.6\efel
    copying efel\__init__.py -> build\lib.win-amd64-3.6\efel
    copying efel\DependencyV5.txt -> build\lib.win-amd64-3.6\efel
    creating build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\Utils.h -> build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\LibV1.h -> build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\LibV2.h -> build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\LibV3.h -> build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\LibV4.h -> build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\LibV5.h -> build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\FillFptrTable.h -> build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\DependencyTree.h -> build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\efel.h -> build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\cfeature.h -> build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\Global.h -> build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\mapoperations.h -> build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\types.h -> build\lib.win-amd64-3.6\efel\cppcore
    copying efel\cppcore\eFELLogger.h -> build\lib.win-amd64-3.6\efel\cppcore
    UPDATING build\lib.win-amd64-3.6\efel/_version.py
    set build\lib.win-amd64-3.6\efel/_version.py to '2.12.11'
    running build_ext
    building 'efel.cppcore' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    ----------------------------------------
  Failed building wheel for efel
Command "C:\Users\Alex\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Alex\\AppData\\Local\\Temp\\pip-build-cygqwlch\\efel\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Alex\AppData\Local\Temp\pip-n69ud86n-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Alex\AppData\Local\Temp\pip-build-cygqwlch\efel\
Requirement already satisfied: NEURON in c:\users\alex\anaconda3\lib\site-packages
在Jupyter笔记本中使用python 2内核时,可能还有一些有用的信息:

In [1]:
import sys
sys.executable

Out [1]:
'C:\\Users\\Alex\\Anaconda3\\envs\\ipykernel_py2\\python.exe'  #kernel python 2.7
'C:\\Users\\Alex\\Anaconda3\\python.exe' #kernel python 3

In [2]:
from jupyter_core.paths import jupyter_data_dir
print(jupyter_data_dir())

Out[2]:
C:\Users\Alex\AppData\Roaming\jupyter

In[3]:
sys.path

Out[3]:
['',
 'C:\\Users\\Alex\\Anaconda3\\envs\\ipykernel_py2\\python27.zip',
 'C:\\Users\\Alex\\Anaconda3\\envs\\ipykernel_py2\\DLLs',
 'C:\\Users\\Alex\\Anaconda3\\envs\\ipykernel_py2\\lib',
 'C:\\Users\\Alex\\Anaconda3\\envs\\ipykernel_py2\\lib\\plat-win',
 'C:\\Users\\Alex\\Anaconda3\\envs\\ipykernel_py2\\lib\\lib-tk',
 'C:\\Users\\Alex\\Anaconda3\\envs\\ipykernel_py2',
 'C:\\Users\\Alex\\Anaconda3\\envs\\ipykernel_py2\\lib\\site-packages',
 'C:\\Users\\Alex\\Anaconda3\\envs\\ipykernel_py2\\lib\\site-packages\\IPython\\extensions',
 'C:\\Users\\Alex\\.ipython']

In[4]:
!jupyter kernelspec list

Out[4]:
Available kernels:
  python3    C:\Users\Alex\Anaconda3\share\jupyter\kernels\python3
  python2    C:\ProgramData\jupyter\kernels\python2

我可以看到模块没有正确安装,并且对微软Visual C++ 14提供了依赖性。

尝试从这个链接

安装微软Visual C++构建工具 然后再次尝试使用pip安装模块

pip install bluepyopt

我可以看到模块没有正确安装,并且对微软Visual C++ 14提供了依赖性。

尝试从这个链接

安装微软Visual C++构建工具 然后再次尝试使用pip安装模块

pip install bluepyopt

谢谢你的评论!我安装了微软Visual C++可重新分配的FUR Visual Studio 2017,它没有改变任何东西。不要安装VisualStudio构建工具,安装VisualC++ 2015的构建工具,解决了我的Python 3内核的问题!美好的但是,如果我将其安装在Python2.7内核中,则会得到相同的输出和导入错误。奇怪。对于Python2.7,您需要更老的版本。@Svenonito如果答案对您有帮助,请投票。谢谢!谢谢你的评论!我安装了微软Visual C++可重新分配的FUR Visual Studio 2017,它没有改变任何东西。不要安装VisualStudio构建工具,安装VisualC++ 2015的构建工具,解决了我的Python 3内核的问题!美好的但是,如果我将其安装在Python2.7内核中,则会得到相同的输出和导入错误。奇怪。对于Python2.7,您需要更老的版本。@Svenonito如果答案对您有帮助,请投票。谢谢!可能的重复可能的重复