使用Anaconda安装本地软件包

时间:2017-06-26 15:52:05

标签: python python-2.7 anaconda pymysql

我在Windows 7机器上使用带有64位Python 2.7的Anaconda,它必然与互联网隔离。我在安装本地软件包时遇到了困难。现在我被困在PyMySQL上,但我想我也会遇到与其他软件包相同的问题。我的系统PATH变量开头有Anaconda。

尝试解压缩文件夹的路径:

conda install –-offline c:\temp\PyMySQL-master\pymysql
PackageNotFoundError: Package missing in current win-64 channels:
  - c:\temp\pymysql-master\pymysql

这个错误是什么意思?我尝试使用tar文件,我得到相同的错误消息。如果我拼写错误的文件名,这就是我得到的相同消息,所以我缺少一些让它识别文件的东西。我是否需要为本地包创建频道?我该怎么办?还有什么我应该尝试的吗?

以下是详细模式下的响应:

conda install --offline --verbose c:\temp\pymysql.tar
Fetching package metadata ...........
An unexpected error has occurred.
Please consider posting the following information to the
conda GitHub issue tracker at:

    https://github.com/conda/conda/issues

Current conda install:

               platform : win-64
          conda version : 4.3.21
       conda is private : False
      conda-env version : 4.3.21
    conda-build version : not installed
         python version : 2.7.13.final.0
       requests version : 2.14.2
       root environment : C:\ProgramData\Anaconda2  (writable)
    default environment : C:\ProgramData\Anaconda2
       envs directories : C:\ProgramData\Anaconda2\envs
                          C:\Users\lab1\AppData\Local\conda\conda\envs
                          C:\cygwin\home\lab1\.conda\envs
          package cache : C:\ProgramData\Anaconda2\pkgs
                          C:\Users\lab1\AppData\Local\conda\conda\pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/win-64  (offline)
                          https://repo.continuum.io/pkgs/free/noarch  (offline)
                          https://repo.continuum.io/pkgs/r/win-64  (offline)
                          https://repo.continuum.io/pkgs/r/noarch  (offline)
                          https://repo.continuum.io/pkgs/pro/win-64  (offline)
                          https://repo.continuum.io/pkgs/pro/noarch  (offline)
                          https://repo.continuum.io/pkgs/msys2/win-64  (offline)
                          https://repo.continuum.io/pkgs/msys2/noarch  (offline)
            config file : C:\cygwin\home\lab1\.condarc
             netrc file : None
           offline mode : True
             user-agent : conda/4.3.21 requests/2.14.2 CPython/2.7.13 Windows/7 Windows/6.1.7601
          administrator : True

`$ C:\ProgramData\Anaconda2\Scripts\conda-script.py install --offline --verbose c:\temp\pymysql.tar`

    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda2\lib\site-packages\conda\exceptions.py", line 632, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "C:\ProgramData\Anaconda2\lib\site-packages\conda\cli\main.py", line 137, in _main
        exit_code = args.func(args, p)
      File "C:\ProgramData\Anaconda2\lib\site-packages\conda\cli\main_install.py", line 80, in execute
        install(args, parser, 'install')
      File "C:\ProgramData\Anaconda2\lib\site-packages\conda\cli\install.py", line 306, in install
        raise PackageNotFoundError(error_message)
    PackageNotFoundError: Package missing in current win-64 channels:
      - c:\temp\pymysql.tar

1 个答案:

答案 0 :(得分:1)

迄今为止构建的每个conda包都有一个.tar.bz2扩展名,而且这个假设已经深入了解。有一天,我们可能会添加不同的包类型,压缩算法和扩展,但这还有一段路要走。所以要工作,你的命令必须是

conda install --offline --verbose c:\temp\pymysql.tar.bz2

pymysql.tar.bz2需要是一个真正的conda包。 (即如果您解压缩该tarball并且其中没有info/files个文件,那么它不是conda包)