简体   繁体   English

将plyfile安装到Anaconda3

[英]Installing plyfile to Anaconda3

I run the following line from Spyder (Anaconda3): 我从Spyder(Anaconda3)运行以下行:

 from plyfile import PlyData, PlyElement

and I get the following error message: 我收到以下错误消息:

 Traceback (most recent call last):
 File "<ipython-input-269-2c796028388e>", line 1, in <module>
 from plyfile import PlyData, PlyElement
 ImportError: No module named 'plyfile'

Next I went to the Anaconda3 Scripts subdirectory and using the Windows Commander I wrote: 接下来,我进入Anaconda3 Scripts子目录,并使用编写的Windows Commander:

conda install plyfile

I received the following error message: 我收到以下错误消息:

PackageNotFound: Package not found: "Package missing in current win 64     channels:
-plyfile

I made a search using the Google and I found the plyfile in the following address https://pypi.python.org/pypi/plyfile , but then I do not know what to do with it. 我使用Google进行搜索,然后在以下地址https://pypi.python.org/pypi/plyfile中找到了plyfile,但是后来我不知道该怎么做。

Could you please help me? 请你帮助我好吗?

pip install plyfile ,如果默认的anaconda存储库中没有某些东西,但仍然是pypi软件包,则可以pip install,conda仍会在您的环境中跟踪该软件包。

Try this. 尝试这个。 This worked for me. 这对我有用。

sudo su
pip install plyfile

I got plyfile to work in the Windows 10 Pro environment using Spyder 3.1.3, with a Python 2.7 environment on Anaconda as follows: 我使用Spyder 3.1.3在Windows 10 Pro环境中使用plyfile,并在Anaconda上使用Python 2.7环境,如下所示:

  1. Open the plyfile.py program file in Spyder #This program is in the plyfile-05 file in the pkgs subdirectory of anaconda3. 在Spyder#中打开plyfile.py程序文件。此程序位于anaconda3的pkgs子目录中的plyfile-05文件中。

  2. Run the plyfile.py program in spyder3 and run "import plyfile" from the IPython console. 在spyder3中运行plyfile.py程序,然后从IPython控制台运行“ import plyfile”。 #If you use the "from plyfile import PlyData, PlyElement" statement you will get an error : TypeError: 'NoneType' object is not callable' when you run a program that calls PlyData or PlyElement. #如果您使用“从plyfile导入PlyData,PlyElement”语句,则会在运行调用PlyData或PlyElement的程序时收到错误:TypeError:'NoneType'对象不可调用'。

  3. Remove any import statement like "from plyfile import PlyData, PlyElement" from the program you want to use plyfile in. #Otherwise you will get the TypeError above when you run your program file. 从要在其中使用plyfile的程序中删除任何导入语句,例如“从plyfile import PlyData,PlyElement”。#否则,当您运行程序文件时,将收到上述TypeError。

  4. Run your .py file now and the 3D figure should be generated. 立即运行.py文件,应生成3D图形。

First activate the conda environment where you want to install the plyfile package 首先激活要在其中安装plyfile软件包的conda环境。

source activate environment_name 源激活环境名称

Then use pip to install the plyfile package 然后使用pip安装plyfile软件包

pip install plyfile pip安装plyfile

After that you can check whether the package has been installed in the same conda environment by using 之后,您可以使用以下命令检查软件包是否已安装在相同的conda环境中

conda list 康达清单

Find out executable used by Spyder or Jupyter 找出Spyder或Jupyter使用的可执行文件

import sys
sys.executable

If its not using virtual environment executable 如果不使用虚拟环境可执行文件

Setup ipykernal to use the virtual environment ( devconda ). 设置ipykernal以使用虚拟环境( devconda )。

python -m ipykernel install --user --name=devconda

After this 在这之后

sys.executable

/opt/anaconda/envs/devconda/bin/python / opt / anaconda / envs / devconda / bin / python

And the pip imports will work in Jupyter or Spyder 点导入将在Jupyter或Spyder中工作

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

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