在Windows 7上安装scikit-learn for python 3.3

时间:2013-01-08 00:49:02

标签: scikit-learn python-3.3

我真的很擅长使用Python和可以安装的相关软件包。 作为一名生物学家,我正在寻找许多可以帮助我模拟物种系统,生态变化等的新包装。经过大量的“Google-ing”之后,我遇到了scikit-learn。 但是,我在安装它时遇到了问题。现在我将采取这一时刻为这篇文章的篇幅道歉。

我正在使用64位Python 3.3并且具有相关的NumPy(MKL 1.7.0)和SciPy。我安装了分发工作正常,并允许我使用easy_install。 所以要安装scikit-learn,我尝试使用cmd提示符(Windows)以管理员模式运行,然后也通过Python命令行运行。 我将下载并解压缩的tar.gz文件放在Lib \ site-packages文件夹中。 当我运行命令      easy_install scikit-learn 在cmd提示符下。 然后这是以下输出:

C:\Python33\Lib\site-packages>easy_install -U scikit-learn
Searching for scikit-learn
Reading http://pypi.python.org/simple/scikit-learn/
Reading http://scikit-learn.org
Reading http://sourceforge.net/projects/scikit-learn/files/
Reading http://scikit-learn.sourceforge.net
Best match: scikit-learn 0.12.1
Downloading http://pypi.python.org/packages/source/s/scikit-learn/scikit-learn-0
.12.1.tar.gz#md5=7e8b3434f9e8198b82dc3774f8bc9394
Processing scikit-learn-0.12.1.tar.gz
Writing c:\users\nuvraj~1\appdata\local\temp\easy_install-kvr2q0\scikit-learn-0.
12.1\setup.cfg
Running scikit-learn-0.12.1\setup.py -q bdist_egg --dist-dir c:\users\nuvraj~1\a
ppdata\local\temp\easy_install-kvr2q0\scikit-learn-0.12.1\egg-dist-tmp-l618ie
Traceback (most recent call last):
  File "C:\Python33\Scripts\easy_install-script.py", line 9, in <module>
    load_entry_point('distribute==0.6.33', 'console_scripts', 'easy_install')()
  File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line
1937, in main
    with_ei_usage(lambda:
  File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line
1918, in with_ei_usage
    return f()
  File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line
1941, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "C:\Python33\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Python33\lib\distutils\dist.py", line 917, in run_commands
    self.run_command(cmd)
  File "C:\Python33\lib\distutils\dist.py", line 936, in run_command
    cmd_obj.run()
  File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line
358, in run
    self.easy_install(spec, not self.no_deps)
  File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line
598, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line
628, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line
823, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line
1103, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "C:\Python33\lib\site-packages\setuptools\command\easy_install.py", line
1089, in run_setup
    run_setup(setup_script, args)
  File "C:\Python33\lib\site-packages\setuptools\sandbox.py", line 34, in run_se
tup
    lambda: exec(compile(open(
  File "C:\Python33\lib\site-packages\setuptools\sandbox.py", line 82, in run
    return func()
  File "C:\Python33\lib\site-packages\setuptools\sandbox.py", line 37, in <lambd
a>
    {'__file__':setup_script, '__name__':'__main__'})
  File "setup.py", line 33, in <module>
  File "c:\users\nuvraj~1\appdata\local\temp\easy_install-kvr2q0\scikit-learn-0.
12.1\sklearn\__init__.py", line 86
    print "I: Seeding RNGs with %r" % _random_seed
                                  ^
SyntaxError: invalid syntax

C:\Python33\Lib\site-packages>

所以小^似乎指向“在带有%r的RNGS之后。我可以告诉它来自.tar中找到的sklearn文件夹中的' init '文件。 gz文件。

在Python GUI和命令行中运行它时,我也得到相同的结果。

如何使用Python 3.3安装scikit-learn?有没有办法构建它或编辑文件以通过这个无效的语法错误?

非常感谢任何帮助。我很抱歉这么长的帖子。我只是想在那里得到所有细节。

由于 西蒙

2 个答案:

答案 0 :(得分:2)

scikit-learn还不支持Python 3。现在你需要Python 2.7。

对于计划于2013年第二季度发布的0.14版本,预计将对Python 3提供适当的支持。

答案 1 :(得分:0)

我不是专家,但据我所知,Python 3中的print语句现在是一个函数,名为:print()。因此,在这种情况下,快速解决方案是改变

print "I: Seeding RNGs with %r" % _random_seed

print("I: Seeding RNGs with %r" % _random_seed)