使用pip安装在需求中丢失了分布规范错误

时间:2023-01-12 19:29:27

I have just created a fresh virtualenv into which I want to run my pip install. However, I'm getting this error:

我刚刚创建了一个新的virtualenv,我希望在其中运行pip安装。但是,我得到了这个错误:

raise ValueError("Missing distribution spec", line)
ValueError: ('Missing distribution spec', '/path/to/dir/requirements.txt')

My requirements.txt:

我让:

Django==1.3
Jinja2==2.6
MySQL-python==1.2.3
PIL==1.1.7
Pygments==1.5
Sphinx==1.1.3
Werkzeug==0.8.3
django-debug-toolbar==0.9.4
django-excel-response==1.0
django-extensions==0.8
docutils==0.9.1
ipython==0.12
wsgiref==0.1.2

What is going wrong?

什么错了吗?

4 个解决方案

#1


18  

You must be doing something wrong. Something like: pip install path/to/requirements.txt, but the requirements file must be passed with -r argument:

你一定是做错了什么。类似:pip安装路径/到/需求。txt,但是要求文件必须通过-r参数:

pip install -r path/to/requirements.txt

/ /让pip安装- r路径

Hugs.

拥抱。

#2


15  

I'd like to complete the answer if anyone runs in the same variant as I did: I was running everything on a Windows environment (windows 7). Under powershell, I had ran

如果有人和我一样运行,我想要完成这个问题:我运行Windows环境下的所有东西(Windows 7)。在powershell下,我运行了。

pip freeze > requirements.txt

When I tested on a new virtualenv, I had the same error as above. The problem was an encoding issue (ugh): make sure the requirements.txt file is written in UTF-8 (without BOM). Notepad++ or sublime text can make sure of that.

当我在一个新的virtualenv上测试时,我有和上面一样的错误。问题是一个编码问题:确保需求。txt文件是用UTF-8(没有BOM)编写的。Notepad++或卓越的文本可以确保这一点。

Hope it helps anyone else for the which the answer above was not enough.

希望它能帮助别人,而上面的答案是不够的。

#3


2  

My issue ending up being that in some terminals, – and - look exactly the same. I had –r and it threw this error. You want -r.

我的问题是,在某些终端,-和-看起来完全一样。我有-r,它抛出了这个错误。你想要的- r。

#4


0  

if you are pushing to Azure, even with utf-8 you might also run into this problem:

如果您正在开发Azure,即使使用utf-8,也可能会遇到以下问题:

ValueError: ('Missing distribution spec', '\xef\xbb\xbfDjango==1.11.4')

ValueError:('丢失的分布规范','\xef\xbb\xbfDjango==1.11.4')

the safe way is to save as requirements.txt as ansi file.

安全的方法是按要求保存。txt作为ansi文件。

well, given you are running on windows

既然你在windows上运行

#1


18  

You must be doing something wrong. Something like: pip install path/to/requirements.txt, but the requirements file must be passed with -r argument:

你一定是做错了什么。类似:pip安装路径/到/需求。txt,但是要求文件必须通过-r参数:

pip install -r path/to/requirements.txt

/ /让pip安装- r路径

Hugs.

拥抱。

#2


15  

I'd like to complete the answer if anyone runs in the same variant as I did: I was running everything on a Windows environment (windows 7). Under powershell, I had ran

如果有人和我一样运行,我想要完成这个问题:我运行Windows环境下的所有东西(Windows 7)。在powershell下,我运行了。

pip freeze > requirements.txt

When I tested on a new virtualenv, I had the same error as above. The problem was an encoding issue (ugh): make sure the requirements.txt file is written in UTF-8 (without BOM). Notepad++ or sublime text can make sure of that.

当我在一个新的virtualenv上测试时,我有和上面一样的错误。问题是一个编码问题:确保需求。txt文件是用UTF-8(没有BOM)编写的。Notepad++或卓越的文本可以确保这一点。

Hope it helps anyone else for the which the answer above was not enough.

希望它能帮助别人,而上面的答案是不够的。

#3


2  

My issue ending up being that in some terminals, – and - look exactly the same. I had –r and it threw this error. You want -r.

我的问题是,在某些终端,-和-看起来完全一样。我有-r,它抛出了这个错误。你想要的- r。

#4


0  

if you are pushing to Azure, even with utf-8 you might also run into this problem:

如果您正在开发Azure,即使使用utf-8,也可能会遇到以下问题:

ValueError: ('Missing distribution spec', '\xef\xbb\xbfDjango==1.11.4')

ValueError:('丢失的分布规范','\xef\xbb\xbfDjango==1.11.4')

the safe way is to save as requirements.txt as ansi file.

安全的方法是按要求保存。txt作为ansi文件。

well, given you are running on windows

既然你在windows上运行