在OS x上安装Tweepy

2024-06-02 13:04:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在尝试通过在OSx上安装tweepy

pip install tweepy

我已经安装了pip,但是我收到了一条奇怪的错误消息,我以前没有来过accross,显然Tweepy根本就没有导入(因为它还没有安装)。在

我收到以下错误消息:

错误:无法创建“/Library/Python/2.7/site packages/tests”:权限被拒绝

我有什么办法可以准许吗?我做错什么了?在

提前谢谢

附加信息:如果从路径上看不出来,请运行Python2.7


Tags: installpip信息消息权限packages错误library
1条回答
网友
1楼 · 发布于 2024-06-02 13:04:48

正如Alko所提到的,您需要root权限才能写入pip存储包的目录。在

您可以键入:

sudo su

在终端中,然后键入:

^{pr2}$

或者,您可以使用virtualenv

"What if you can't install packages into the global site-packages directory? For instance, on a shared host.

In all these cases, virtualenv can help you. It creates an environment that has its own installation directories, that doesn't share libraries with other virtualenv environments (and optionally doesn't access the globally installed libraries either)."

基本上,它将允许您为每个python项目创建独立的环境,并允许您回避您的权限问题。在

有关详细说明,请参见:Installing Python on Mac OS X: virtualenv

相关问题 更多 >