我对Python和可以安装的相关包的使用非常陌生。作为一名生物学家,我正在寻找许多新的软件包,可以帮助我模拟物种系统,生态变化等。在经历了很多“谷歌-ing”之后,我发现了一些科学知识。但是,我在安装它时遇到了困难。现在我要为这篇文章的篇幅道歉。
我使用64位Python3.3,并具有关联的NumPy (MKL1.7.0)和SciPy。我安装了发行版,运行良好,允许我使用easy_install。因此,为了安装scikit-learn,我尝试使用cmd提示符(Windows)在管理员模式下运行,然后通过Python命令行运行。我将下载和解压缩的tar.gz文件放在Lib\site-packages文件夹中。当我在cmd提示符中运行命令easy_install scikit-learn时。然后是以下输出:
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‘文件中。
在Python和命令行中运行它时,我也得到了相同的结果。
如何使用Python3.3安装scikit-学习?是否有某种方法来构建它或编辑文件以克服这个无效的语法错误?
任何帮助都将不胜感激。我很抱歉这是个很长的职位。我只是想把所有的细节都弄清楚。
谢谢西蒙
发布于 2013-01-08 09:39:47
scikit-学习还不支持Python 3。现在您需要Python2.7。
对Python3的适当支持预计将在2013年第二季度发布的0.14版本中实现。
发布于 2013-06-17 18:40:34
我不是专家,但据我理解,Python3.*中的print语句现在是一个函数,名为: print()。因此,在这种情况下,一个快速的解决方案是改变
print "I: Seeding RNGs with %r" % _random_seed至
print("I: Seeding RNGs with %r" % _random_seed)https://stackoverflow.com/questions/14206637
复制相似问题