简体   繁体   中英

Installing plyfile to Anaconda3

I run the following line from 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:

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.

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:

  1. Open the plyfile.py program file in Spyder #This program is in the plyfile-05 file in the pkgs subdirectory of anaconda3.

  2. Run the plyfile.py program in spyder3 and run "import plyfile" from the IPython console. #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.

  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.

  4. Run your .py file now and the 3D figure should be generated.

First activate the conda environment where you want to install the plyfile package

source activate environment_name

Then use pip to install the plyfile package

pip install plyfile

After that you can check whether the package has been installed in the same conda environment by using

conda list

Find out executable used by Spyder or Jupyter

import sys
sys.executable

If its not using virtual environment executable

Setup ipykernal to use the virtual environment ( devconda ).

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

After this

sys.executable

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

And the pip imports will work in Jupyter or Spyder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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