簡體   English   中英

如何在Enthought Python中安裝外部軟件包?

[英]How to install external packages in Enthought Python?

我正在嘗試在我的Enthought python安裝(在Windows7下)下安裝rpy2以與Ipython一起使用,但是無法使其正常工作(我第一次嘗試安裝外部軟件包)。 據我所知,pip可以在Enthought下使用,以安裝外部軟件包(請參閱例如使用非EPD軟件包安裝程序,例如pip ),並且該軟件包似乎已下載。 EPD-python也是我的首選之路,因此這不應該成為問題。 但是,在安裝過程中error: invalid command 'egg_info'

我還嘗試了此問題中的建議以顯式添加PATH前綴: 使用pip將Python軟件包安裝到其他目​​錄中嗎? (問題似乎並不在於路徑問題)。

我也曾在invalid command 'egg_info'錯誤中看到此Q ,並建議升級setuptools,但是Enthought明確警告不要與其他版本的setuptools混在一起(請參閱從OS命令行將程序包安裝到Canopy User Python中 )-也許是這樣是否認為過時的信息?

這可能是一個瑣碎的問題,但我無法解決這個問題。

命令:

pip install rpy2

日志文件的一部分粘貼在下面:

Downloading from URL https://pypi.python.org/packages/source/r/rpy2/rpy2-2.4.3.tar.gz#md5=57e3fda409226dffb543c913c8553cdc (from https://pypi.python.org/simple/rpy2/)
  Running setup.py (path:c:\users\tobjep\appdata\local\temp\pip_build_tobjep\rpy2\setup.py) egg_info for package rpy2
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: invalid command 'egg_info'
    Complete output from command python setup.py egg_info:
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

   or: -c --help [cmd1 cmd2 ...]

   or: -c --help-commands

   or: -c cmd --help

error: invalid command 'egg_info'

----------------------------------------
Cleaning up...
  Removing temporary dir c:\users\tobjep\appdata\local\temp\pip_build_tobjep...
Command python setup.py egg_info failed with error code 1 in c:\users\tobjep\appdata\local\temp\pip_build_tobjep\rpy2
Exception information:
Traceback (most recent call last):
  File "C:\Program_\EPD_python27\lib\site-packages\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "C:\Program_\EPD_python27\lib\site-packages\pip\commands\install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "C:\Program_\EPD_python27\lib\site-packages\pip\req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "C:\Program_\EPD_python27\lib\site-packages\pip\req.py", line 325, in run_egg_info
    command_desc='python setup.py egg_info')
  File "C:\Program_\EPD_python27\lib\site-packages\pip\util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in c:\users\tobjep\appdata\local\temp\pip_build_tobjep\rpy2

更新:遵循其他建議,我嘗試安裝distributeenpkg distribute ),然后重新安裝pip 之后,rpy2的安裝仍然失敗,但是現在出現錯誤NameError: name 'sys_platform' is not defined

Traceback (most recent call last):
  File "<string>", line 17, in <module>
  File "c:\users\tobjep\appdata\local\temp\pip_build_tobjep\rpy2\setup.py", line 447, in <module>
    'rpy2': ['doc/source/rpy2_logo.png', ]}
  File "C:\Program_\EPD_python27\lib\distutils\core.py", line 112, in setup
    _setup_distribution = dist = klass(attrs)
  File "C:\Program_\EPD_python27\lib\site-packages\setuptools\dist.py", line 225, in __init__
    _Distribution.__init__(self,attrs)
  File "C:\Program_\EPD_python27\lib\distutils\dist.py", line 287, in __init__
    self.finalize_options()
  File "C:\Program_\EPD_python27\lib\site-packages\setuptools\dist.py", line 257, in finalize_options
    ep.require(installer=self.fetch_build_egg)
  File "C:\Program_\EPD_python27\lib\site-packages\pkg_resources.py", line 2099, in require
    working_set.resolve(self.dist.requires(self.extras),env,installer))
  File "C:\Program_\EPD_python27\lib\site-packages\pkg_resources.py", line 2309, in requires
    dm = self._dep_map
  File "C:\Program_\EPD_python27\lib\site-packages\pkg_resources.py", line 2538, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "C:\Program_\EPD_python27\lib\site-packages\pkg_resources.py", line 2571, in _compute_dependencies
    common = frozenset(reqs_for_extra(None))
  File "C:\Program_\EPD_python27\lib\site-packages\pkg_resources.py", line 2568, in reqs_for_extra
    if req.marker_fn(override={'extra':extra}):
  File "C:\Program_\EPD_python27\lib\site-packages\_markerlib\markers.py", line 109, in marker_fn
    return eval(compiled_marker, environment)
  File "<environment marker>", line 1, in <module>
NameError: name 'sys_platform' is not defined
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

rpy2據說很難在Windows上構建。

目前,我最好的建議是嘗試安裝Chris Gohlke的實驗性二進制版本: http ://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2

由於他的安裝程序使用Windows注冊表指向Python,因此您實際上應該在Canopy首選項中將Canopy設置為默認的Python,而不僅僅是使用Canopy命令提示符窗口。 您鏈接的文章中對此進行了描述: https : //support.enthought.com/entries/23389761-Installing-packages-into-Canopy-Python-from-the-command-line

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM