[英]Error when installing python settuptools - No such file or directory: '/usr/local/lib/python2.7/site-packages/test-easy-install-8811.pth'
I'm trying to install settuptools on a linux machine that I don't have root access. 我正在尝试在没有root访问权限的linux机器上安装settuptools。 I already create the virtual python.
我已经创建了虚拟python。
dgomez:~/download> which python
/home/dgomez/bin/python
when I do the following, I get an error: 当我执行以下操作时,出现错误:
/home/dgomez/bin/python ez_setup.py
Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 2] No such file or directory: '/usr/local/lib/python2.7/site-packages/test-easy-install-8816.pth'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python2.7/site-packages/
This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option). 选项)。
I would like to know how to fix this. 我想知道如何解决这个问题。 I see in other forum where the user fixed it by creating the directory, but in my case I don't have root access for I can't create a directory.
我在其他论坛上看到用户通过创建目录来修复该目录,但是在我的情况下,我没有超级用户访问权限,因为我无法创建目录。 Thanks
谢谢
I ran the python 我跑了蟒蛇
ez_setup.py --install-dir=/home/dgomez/lib/python2.7/site-packages/
Bu still getting an error: Bu仍然出现错误:
You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from. The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/home/dgomez/lib/python2.7/site-packages/
and your PYTHONPATH environment variable currently contains:
''
The error message tells you exactly what to do, use the --install-dir
or --prefix
option so the package installs to your virtual Python installation instead of the default location. 错误消息会告诉您确切的操作,请使用
--install-dir
或--prefix
选项,以便将程序包安装到虚拟Python安装而不是默认位置。
This might look something like this: 这可能看起来像这样:
/home/dgomez/bin/python ez_setup.py --prefix=/home/dgomez
Or with --install-dir
: 或
--install-dir
:
/home/dgomez/bin/python ez_setup.py --install-dir=/home/dgomez/lib/python2.7/site-packages
Note that you may need to modify the directories used in the options above depending on the actual location of the site-packages directory of your Python installation. 请注意,您可能需要修改以上选项中使用的目录,具体取决于Python安装的site-packages目录的实际位置。
edit: To fix the new error you are seeing, you need to add that directory to the PYTHONPATH
environment variable, you can do that with the following command: 编辑:要解决新错误,您需要将该目录添加到
PYTHONPATH
环境变量中,可以使用以下命令进行操作:
export PYTHONPATH=$PYTHONPATH:/home/dgomez/lib/python2.7/site-packages/
If you are using bash on a Mac or GNU/Linux distro, you can add that line to your ~/.bashrc
file so that you won't need to run it manually. 如果在Mac或GNU / Linux发行版上使用bash,则可以将该行添加到
~/.bashrc
文件中,这样就无需手动运行它。
I met the same issue. 我遇到了同样的问题。 Somehow this directory had been deleted, so I did not have pip and setuptools.
不知何故,此目录已被删除,因此我没有pip和setuptools。 The way I solved is to download pip directly from pip website .
我解决的方法是直接从pip网站下载pip。 I solved it by downloading the pip file from get-pip.py .
我通过从get-pip.py下载pip文件解决了该问题。 After downloading, just run this file in your python direction, you can use this setuptools again.
下载后,只需按python方向运行此文件,即可再次使用此setuptools。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.