如何在mac中安装setuptools ?

时间:2023-01-06 10:46:12

I'm trying to install via pip some libraries but I'm having some problems.

我正在尝试通过pip安装一些库,但是我有一些问题。

When I try to install some of them I require for my project I get this message:

当我试图安装一些我需要的项目时,我得到了这个信息:

$ sudo pip install dj-database-url==0.2.0
Downloading/unpacking dj-database-url==0.2.0
  Downloading dj-database-url-0.2.0.tar.gz
Cleaning up...
setuptools must be installed to install from a source distribution

It also happens when trying to install distribute==0.6.24

在尝试安装分布式==0.6.24时也会发生这种情况。

Any ideas?

什么好主意吗?

2 个解决方案

#1


16  

1) Download ez_setup.py module from

1)下载ez_setup。py模块从

https://pypi.python.org/pypi/setuptools

https://pypi.python.org/pypi/setuptools

2) Open a Terminal

2)打开一个终端

3) cd to the directory where you put the 'ez_setup.py'

3)cd到你放置“ez_setup.py”的目录

4) type 'python ez_setup.py' and run it.

4)类型的python ez_setup。py和运行它。

5) You should have it then.

那你就买吧。

#2


0  

After a pip install command I was getting the same error as you ("setuptools must be installed to install from a source distribution"). Since I couldn't find a solution, it was a lot faster to reinstall the virtual environment where python was running from.

在pip安装命令之后,我得到了与您相同的错误(“必须安装setuptools才能从源发行版进行安装”)。因为我找不到解决方案,所以重新安装python所在的虚拟环境要快得多。

If you're using virtualenvwrapper this is very easy. First you remove your problematic virtual environment (let's say it is called "venv") with:

如果您使用的是virtualenvwrapper,那么它非常简单。首先,用以下方法删除有问题的虚拟环境(假设它被称为“venv”):

rmvirtualenv venv

Then you setup a new one with the same name:

然后你建立一个新的名字相同的名字:

mkvirtualenv venv

And finally you install all your packages, including the one you had problems with:

最后,你安装了所有的软件包,包括你有问题的那个:

pip install dj-database-url

#1


16  

1) Download ez_setup.py module from

1)下载ez_setup。py模块从

https://pypi.python.org/pypi/setuptools

https://pypi.python.org/pypi/setuptools

2) Open a Terminal

2)打开一个终端

3) cd to the directory where you put the 'ez_setup.py'

3)cd到你放置“ez_setup.py”的目录

4) type 'python ez_setup.py' and run it.

4)类型的python ez_setup。py和运行它。

5) You should have it then.

那你就买吧。

#2


0  

After a pip install command I was getting the same error as you ("setuptools must be installed to install from a source distribution"). Since I couldn't find a solution, it was a lot faster to reinstall the virtual environment where python was running from.

在pip安装命令之后,我得到了与您相同的错误(“必须安装setuptools才能从源发行版进行安装”)。因为我找不到解决方案,所以重新安装python所在的虚拟环境要快得多。

If you're using virtualenvwrapper this is very easy. First you remove your problematic virtual environment (let's say it is called "venv") with:

如果您使用的是virtualenvwrapper,那么它非常简单。首先,用以下方法删除有问题的虚拟环境(假设它被称为“venv”):

rmvirtualenv venv

Then you setup a new one with the same name:

然后你建立一个新的名字相同的名字:

mkvirtualenv venv

And finally you install all your packages, including the one you had problems with:

最后,你安装了所有的软件包,包括你有问题的那个:

pip install dj-database-url