简体   繁体   English

使用conda或pip为Python安装dicompyler

[英]Install dicompyler for python using conda or pip

I am trying to install dicompyler to read DICOM-RT plan files through conda, but getting a 'PackageNotFoundError'. 我正在尝试安装dicompyler以通过conda读取DICOM-RT计划文件,但得到“ PackageNotFoundError”。

The package is on Github at https://github.com/dicompyler/dicompyler-core . 该软件包位于Github上, 网址https://github.com/dicompyler/dicompyler-core When downloading and install the tar using 使用下载并安装tar时

pip install [directory\filename]

I get 'Command "python setup.py egg_info" failed with error code 1 in [directory]'. 我收到“命令“ python setup.py egg_info”失败,错误代码为[目录] 1)。

Is there a way to install either through conda or from the tar? 有没有办法通过conda或从tar安装?

I just tried to install the packages from the github, and it seems succeeded. 我只是尝试从github安装软件包,似乎成功了。 Below is my step: 以下是我的步骤:

1:Clone the code: 1:克隆代码:

git clone https://github.com/dicompyler/dicompyler-core.git

2:Install from the source: 2:从源代码安装:

cd dicompyler-core
sudo python3.6 setup.py install

3:Result: 3:结果:

..........
Using /usr/local/lib/python3.6/site-packages
Finished processing dependencies for dicompyler-core==0.5.3


Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2

Type "help", "copyright", "credits" or "license" for more information.
>>> import dicompylercore
>>>

Since you are using Anaconda in your project you need to create its environment in the directory of your project: 由于您在项目中使用Anaconda,因此需要在项目目录中创建其环境:

conda create --name env python=3

Then activate it: 然后激活它:

source activate env

Then download the archive from the github if you're trying to install the package from archive. 如果要从存档安装软件包,请从github下载存档。 Unpack the archive and then enter the unpacked directory and run: 解压缩档案,然后输入解压缩的目录并运行:

python setup.py install

Then it will successfully install the required package dicompyler. 然后它将成功安装所需的软件包dicompyler。

Hope this helps. 希望这可以帮助。

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

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