警告: '' 不是有效的包名; 请在 setup.py 中仅使用以点分隔的包名

2 投票
3 回答
3763 浏览
提问于 2025-04-17 17:28

我遇到了一个GitHub项目,想要安装并运行它,但遇到了一些问题(https://github.com/andrewschoen/django-cms-demo)。我也在这里提了个问题 https://github.com/andrewschoen/django-cms-demo/issues/2

问题似乎和安装PIL有关,如果我理解没错的话:

Running setup.py egg_info for package PIL
WARNING: '' not a valid package name; please use only.-separated package na
es in setup.py

我尝试通过在requirements.txt文件中把这一行改成:Pillow==1.7.8 来“放入”Pillow。

$ pip install -r requirements.txt

............
copying PIL\XVThumbImagePlugin.py -> build\lib.win32-2.7\PIL

running build_ext

building '_imaging' extension

f:\python27\Lib\distutils\dist.py:267: UserWarning: Unknown distribution option:
 'use_2to3'

  warnings.warn(msg)

error: Unable to find vcvarsall.bat

----------------------------------------
Command f:\django-cms-demo\env\Scripts\python.exe -c "import setuptools;__file__
='f:\\django-cms-demo\\env\\build\\Pillow\\setup.py';exec(compile(open(__file__)
.read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\dni
r\appdata\local\temp\pip-cjnff6-record\install-record.txt --single-version-exter
nally-managed --install-headers f:\django-cms-demo\env\include\site\python2.7 fa
iled with error code 1 in f:\django-cms-demo\env\build\Pillow
Storing complete log in m:/pip\pip.log

我刚开始学习Python和Django,之前是用PHP的。我正在尝试在USB驱动器上设置这个项目,并且我是在Windows 7上工作。

提前谢谢你的建议,

比尔

3 个回答

0

你需要把项目的文件夹名字改一下。把名字改成 django_cms_demo

我建议你这样做:

mv django-cms-demo django_cms_demo

不过看起来你是在用Windows系统。

所以,虽然这跟话题没关系,我还是推荐你试试Linux系统。我真不敢想象在Windows上开发Django项目是什么样的。

1

PIL这个东西打包得不太好。

这不是个大问题,别太在意了。

2

PIL这个库打包得不太好,有一些改进版可以解决这个问题。

根据在使用virtualenv或buildout安装PIL时遇到的问题,目前最好的选择是安装Pillow,它可以直接替代PIL。

如果你是在Windows系统上,可以使用Christoph Gohlke提供的预编译安装包

撰写回答