1

在我的 Windows 7 机器上安装 anaconda 后,我尝试使用以下方法安装 tradingwithpython 包。

pip install tr​​adingwithpython

这是成功的,但是当我尝试从 ipython 导入时,出现以下错误:

#==================================================
Python 2.7.6 |Anaconda 1.9.2 (32-bit)| (default, Nov 11 2013, 10:50:31) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 1.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import tradingwithpytohn
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-b118a20534e9> in <module>()
----> 1 import tradingwithpytohn

ImportError: No module named tradingwithpytohn

#==========================================================

所以在此之后我尝试创建一个食谱

C:\Users\dave\Anaconda>conda skeleton pypi tradingwithpython --no-download
tradingwithpython not found, trying Tradingwithpython
Using url https://pypi.python.org/packages/source/t/tradingWithPython/tradingWithPython-0.0.10.zip (20684) for tradingWithPython.
Using "BSD" for the license
Writing recipe for tradingwithpython
Done

然后构建这个包,它给了我这个错误:

C:\Users\dave\Anaconda>conda build tradingwithpython
C:\Users\dave\Anaconda\envs\_build\Lib\SITE-P~1\yaml.dll - Access is denied.
C:\Users\dave\Anaconda\envs\_build\Lib\SITE-P~1\_yaml.pyd - Access is denied.
Fetching package metadata: ...
Solving package specifications: .
The following packages will be linked:

    package                    |            build
    ---------------------------|-----------------
    python-2.7.6               |                0   hard-link

Linking packages ...
[      COMPLETE      ] |#################################################| 100%
BUILD START: tradingwithpython-0.0.10-py27_0
Source cache directory is: C:\Users\dave\Anaconda\conda-bld\src_cache
Found source in cache: tradingWithPython-0.0.10.zip
source tree in: C:\Users\dave\Anaconda\conda-bld\work\tradingWithPython-0.0.10

C:\Users\dave\Anaconda\conda-bld\work\tradingWithPython-0.0.10>call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.ba
t" x86
Setting environment for using Microsoft Visual Studio 2008 x86 tools.

C:\Users\dave\Anaconda\conda-bld\work\tradingWithPython-0.0.10>set TMP=C:\Users\dave\AppData\Local\Temp
....
....
....
C:\Users\dave\Anaconda\conda-bld\work\tradingWithPython-0.0.10>"C:\Users\dave\Anaconda\envs\_build\python.exe" setup.py instal
l
Traceback (most recent call last):
  File "setup.py", line 3, in <module>
    import tradingWithPython as twp
  File "C:\Users\dave\Anaconda\conda-bld\work\tradingWithPython-0.0.10\tradingWithPython\__init__.py", line 5, in <module>
    from lib.functions import *
  File "C:\Users\dave\Anaconda\conda-bld\work\tradingWithPython-0.0.10\tradingWithPython\lib\functions.py", line 9, in <module>
    from scipy  import  polyfit, polyval
ImportError: No module named scipy

C:\Users\dave\Anaconda\conda-bld\work\tradingWithPython-0.0.10>if errorlevel 1 exit 1
Command failed: C:\Windows\system32\cmd.exe /c bld.bat

知道为什么这不起作用吗?

谢谢。

4

2 回答 2

0

ImportError:没有名为 scipy 的模块

可能是您的 Anaconda 安装不完整。Scipy 是一个标准模块,在 Anaconda 安装后应该可以导入。

您的问题似乎很少见,我没有听说过在 Win 7 和 Anaconda 下安装 twp 的问题。

我建议您重新安装 anaconda 并重试。

于 2014-05-02T19:29:08.803 回答
0

将此命令写在笔记本中,而不是在终端中

!pip install tradingWithPython

然后它会自动选择所需的anaconda环境

于 2014-11-09T09:02:36.297 回答