2

私はPythonとインストール可能な関連パッケージの使用に本当に慣れていません。生物学者として、私は種のシステムや生態系の変化などをモデル化するのに役立つ多くの新しいパッケージを探しています。そして、たくさんの「Google-ing」の後で、scikit-learnに出くわしました。しかし、インストールに問題があります。そして、この投稿の長さについてお詫び申し上げます。

64ビットのPython3.3を使用しており、関連するNumPy(MKL 1.7.0)とSciPyがあります。正常に動作し、easy_installを使用できるdistributeをインストールしました。そこで、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.gzファイルにあるsklearnフォルダーの「 init 」ファイルにあります。

PythonGUIとコマンドラインで実行しても同じ結果が得られます。

Python 3.3でscikit-learnをインストールするにはどうすればよいですか?この無効な構文エラーを回避するためにファイルをビルドまたは編集する方法はありますか?

どんな助けでも大歓迎です。そして、それがとても長いポストであることを非常に残念に思います。私はただそこにすべての詳細を取得しようとしていました。

ありがとうサイモン

4

2 に答える 2

2

scikit-learn はまだ Python 3 をサポートしていません。今のところ、Python 2.7 が必要です。

Python 3 の適切なサポートは、2013 年第 2 四半期に予定されている 0.14 リリースで期待されています。

于 2013-01-08T09:39:47.583 に答える
0

私は専門家ではありませんが、私の理解では、Python 3.* の print ステートメントは、print() のように呼び出される関数になりました。したがって、この場合の簡単な解決策は、変更することです

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

print("I: Seeding RNGs with %r" % _random_seed)
于 2013-06-17T18:40:34.820 に答える