scikit-learn - 在 Windows 7 上安装适用于 python 3.3 的 scikit-learn

标签 scikit-learn python-3.3

我对 Python 和可以安装的相关软件包的使用非常陌生。 作为一名生物学家,我正在寻找很多新的软件包来帮助我模拟物种系统、生态变化等。经过大量的“Google-ing”之后,我遇到了 scikit-learn。 但是,我在安装时遇到了问题。我现在要为这篇文章的篇幅表示歉意。

我使用的是 64 位 Python 3.3,并具有关联的 NumPy (MKL 1.7.0) 和 SciPy。我安装了 distribution,它运行良好并且允许我使用 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>

所以小 ^ 似乎指向 RNGS 后面带有 %r 的 "。据我所知,它位于 .tar 中 sklearn 文件夹中的 'init' 文件中。 .gz 文件。

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

如何使用 Python 3.3 安装 scikit-learn?有什么方法可以构建它或编辑文件来克服这个无效的语法错误吗?

任何帮助将不胜感激。我很抱歉这篇文章这么长。我只是想了解其中的所有细节。

谢谢 西蒙

最佳答案

scikit-learn 尚不支持 Python 3。现在您需要 Python 2.7。

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

关于scikit-learn - 在 Windows 7 上安装适用于 python 3.3 的 scikit-learn,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14206637/

相关文章:

python - 为什么我的对数损失(或交叉熵)的实现没有产生相同的结果?

python - 回归中的序数分类数据

python - 如何将字典写入现有文件?

在我的 Python 安装路径中找不到 python33.dll?

machine-learning - 是否可以使用 scikit-learn 指定决策树的分割顺序?

python - 如何计算 K 折交叉验证的不平衡数据集的精度、召回率和 f1 分数?

python - 在 Scipy 中,为什么具有统一概率的 custom.rvs() 仅返回开始区域中的值?

python - Tkinter - 如何将变量分配给列表框中当前选定的项目?

python - 如何在 python 中模拟 http.server 以实现更快的单元测试?