简体   繁体   English

将python模块从exice环境移动到anaconda

[英]move python module from exising environment to anaconda

I want to use 'openface' module on python 3, anaconda. 我想在python 3,anaconda上使用'openface'模块。 so I referred to here. 所以我在这里提到过。

https://github.com/samotiian/Installing_openface_with_anaconda https://github.com/samotiian/Installing_openface_with_anaconda

I don't know why, but it seems that the modules were installed on my existing python,not anaconda environment. 我不知道为什么,但似乎模块安装在我现有的python上,而不是anaconda环境中。

when I import these modules from python(not anaconda environment), it works well. 当我从python(不是anaconda环境)导入这些模块时,它运行良好。

unknownpgr@unknownpgr:~$ python
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:09:58) 

[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sklearn
>>> import openface
>>> 

But It gives such errors when imported from anaconda environment. 但是从anaconda环境导入时会出现这样的错误。

(opencv) unknownpgr@unknownpgr:~$ python
Python 3.6.3 | packaged by conda-forge | (default, Nov  4 2017, 10:10:56) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import openface
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'openface'
>>> import sklearn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sklearn'
>>> 

So my question is : I how can I move these modules from existing environment to anaconda? 所以我的问题是:我如何将这些模块从现有环境转移到anaconda?

(I'm sorry that I'm not good at English. But maybe you can understand what I want to say.) (对不起,我不擅长英语。但也许你能理解我想说的话。)


After some reinstall, I found that the problem was working directory. 经过一些重新安装后,我发现问题是工作目录。 I was working on /home/openface, so I moved 'openface' to ~/anaconda3/envs/myenvironmet/ and It worked well. 我正在/ home / openface上工作,所以我将'openface'移到〜/ anaconda3 / envs / myenvironmet /并且运行良好。

(I'm new to linux and python programming, so I don't know why. Please let me know if you know why python module importing is directory depended to directory.) (我是linux和python编程的新手,所以我不知道为什么。如果你知道为什么python模块导入目录依赖于目录,请告诉我。)

I guess while installing you did not activate your anaconda environment. 我想安装时你没有激活你的anaconda环境。 Repeat the steps after activating your anaconda environment. 激活anaconda环境后重复这些步骤。

Just copy the package folder from the 只需从中复制包文件夹即可

PYTHONHOME/lib/site-packages

to

ANACONDAHOME/lib/site-packages

Should work. 应该管用。 Worked for me. 为我工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM