本文介绍了anaconda 找不到我已经安装的包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过克隆安装 doconce:https://github.com/hplgit/doconce

I am trying to install doconce through the clone: https://github.com/hplgit/doconce

使用:sudo python setup.py install

这安装成功并且which doconce返回

> /usr/local/bin/doconce.

问题是我有 anaconda 以及 python 的常规安装.哪个python返回:

The problem is that I have anaconda along with regular installation of python. which python returns:

>/home/sohail/anaconda/bin/python

现在,当我尝试从/test 运行 test.verify 时,它显示:

Now when I try to run test.verify from /test, it says:

> Traceback (most recent call last):
  File "test.verify", line 13, in <module>
  import commands, os, sys, re, doconce.common, time
  ImportError: No module named doconce.common

作为第二个测试,我创建了一个 do.txt 文件(doconce 文件),当我尝试将其转换为乳胶时,例如它说:

As a second test, I created a do.txt file(doconce file) and when I try to convert it to latex, for example it says:

> ImportError: No module named mistune

虽然包python包misune已经安装,如locate misune所示,返回:

Though the package python package mistune is already installed, as shown by locate mistune which returns:

> /home/sohail/anaconda/conda-meta/mistune-0.5.1-py27_0.json
> /home/sohail/anaconda/lib/python2.7/site-packages/mistune-0.5.1-py2.7.egg-info
> /home/sohail/anaconda/lib/python2.7/site-packages/mistune.py
> /home/sohail/anaconda/lib/python2.7/site-packages/mistune.pyc
> /home/sohail/anaconda/pkgs/mistune-0.5.1-py27_0
> /home/sohail/anaconda/pkgs/mistune-0.5.1-py27_0/info
> /home/sohail/anaconda/pkgs/mistune-0.5.1-py27_0/lib
> /home/sohail/anaconda/pkgs/mistune-0.5.1-py27_0/info/files
> /home/sohail/anaconda/pkgs/mistune-0.5.1-py27_0/info/index.json
> /home/sohail/anaconda/pkgs/mistune-0.5.1-py27_0/info/meta
> /home/sohail/anaconda/pkgs/mistune-0.5.1-py27_0/info/requires
> /home/sohail/anaconda/pkgs/mistune-0.5.1-py27_0/lib/python2.7
> /home/sohail/anaconda/pkgs/mistune-0.5.1-py27_0/lib/python2.7/site-packages
> /home/sohail/anaconda/pkgs/mistune-0.5.1-py27_0/lib/python2.7/site-packages/mistune-0.5.1-py2.7.egg-info
> /home/sohail/anaconda/pkgs/mistune-0.5.1-py27_0/lib/python2.7/site-packages/mistune.py
> /home/sohail/anaconda/pkgs/mistune-0.5.1-py27_0/lib/python2.7/site-packages/mistune.pyc

我对这个问题有一定的了解,即当我运行一些 python 代码时,使用了来自 anaconda 的 python,但是当我尝试运行测试或 .do.txt 文件(doconce 文件)时,它会在外面寻找我的 python 编译器anaconda,因为 doconce 没有安装在 anaconda 内部或作为 anaconda 的一部分,这是问题所在.那么我怎样才能使这项工作,总而言之,我怎样才能将 doconce 包含到 anaconda 中???

I have certain idea about the problem that is when I run some python code, the python from anaconda is used but the when I try to run tests or .do.txt files(doconce files) it looks for my python compilier outside anaconda, since doconce is not installed inside anaconda or as a part of anaconda which is the problem.So how can I make this work, in summary how can I include doconce to anaconda???

推荐答案

pypi中的doconce已经过时,由于doconce的依赖库很大,作者对更新兴趣不大code>,因此使用 对这个特殊问题没什么兴趣.

The doconce at pypi is outdated and the authors have little interest in updating due to large dependency base of doconce, therefore the use of conda skeleton as suggested by @asmeurer in non_recipe_ananconda_installation is of little interest in this particular problem.

我还尝试了 pip install -e git+https://github.com/hplgit/doconce#egg=doconce 有和没有 sudo.使用 sudo 安装成功,但不是 anaconda 的一部分,没有 sudo 会导致以下奇怪错误:

I also tried pip install -e git+https://github.com/hplgit/doconce#egg=doconce with and without sudo. With sudo the install is successful but not as a part of anaconda and without sudo it leads to a weird error of:

error: cannot open .git/FETCH_HEAD: Permission denied

这就是最终可行的方法.首先使用--record=myfile.txt删除sudo python setup.py install安装的所有文件.

This is what that finally works. First delete all the files installed by sudo python setup.py install by using --record=myfile.txt.

现在转到克隆的 doconce 存储库并执行 python setup.py install --prefix=/home/sohail/anaconda/--record=myfile2.txt.

Now go to the cloned doconce repository and do python setup.py install --prefix=/home/sohail/anaconda/ --record=myfile2.txt.

这成功地安装了 doconce 作为 anaconda 默认环境的一部分.现在您可以检查 python 是否也可以接受 doconce 作为其模块,但执行 python -c 'import doconce'sys.modules['doconce'].此外,您还可以通过在 doconceest 中运行测试来验证安装,但请记住 doconce 需要太多依赖项.幸运的是,所有者制作了 test_mintest.py 来验证 doconce 的最小安装.

This successfully installs doconce as a part of anaconda default environment.Now you can check that python can also accept doconce as its module but doing python -c 'import doconce' and sys.modules['doconce']. Moreover you can also verify the installation by running the tests in doconceest, but keep in mind doconce requires too many dependencies. Luckily the owner has made test_mintest.py to verify the minimal installation of doconce.

最后你可以查看conda list |grep doconce 来验证 doconce 现在确实是 anaconda 的一个包.

In the last you can check conda list | grep doconce to verify that doconce is indeed a package now part of anaconda.

此过程已测试安装 doconcelogg-publish 作为 anaconda 的一部分.

This procedure was tested to install doconce and logg-publish as a part of anaconda.

这篇关于anaconda 找不到我已经安装的包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-13 10:22