Python pip安装错误“没有那个文件或目录:setup.py”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33623453/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 13:38:29  来源:igfitidea点击:

pip installation error "No such file or directory: setup.py"

pythontensorflowpipinstall

提问by Zay Maung Maung Aye

I'm getting installation error because pip couldn't find setup.py.

我收到安装错误,因为 pip 找不到 setup.py。

sudo pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl

I get this error message.

我收到此错误消息。

Downloading/unpacking https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
Downloading tensorflow-0.5.0-cp27-none-linux_x86_64.whl (10.9Mb): 10.9Mb downloaded
Running setup.py egg_info for package from https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
Traceback (most recent call last):
File "<string>", line 14, in <module>
IOError: [Errno 2] No such file or directory: '/tmp/pip-GdGgbz-build/setup.py'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "<string>", line 14, in <module>

IOError: [Errno 2] No such file or directory: '/tmp/pip-GdGgbz-build/setup.py'

Can anyone tell me how to solve this problem?

谁能告诉我如何解决这个问题?

Thanks.

谢谢。

回答by pageman

from https://github.com/tensorflow/tensorflow/issues/56

来自https://github.com/tensorflow/tensorflow/issues/56

The command to type is "pip install --upgrade pip", and this should be added to the instructions right after where they tell the user to "source bin/activate"

要键入的命令是"pip install --upgrade pip",这应该在他们告诉用户“source bin/activate”之后立即添加到说明中

回答by gkc123

Tensorflow requires python -V 2.7. Since, lot of machine use the stable 2.6 version of python for their system build I would recommend parallel/alternative install of python 2.7. Then you can install pip with 2.7 version python interpreter. Please see below:

Tensorflow 需要 python -V 2.7。由于许多机器使用稳定的 2.6 版本的 python 进行系统构建,因此我建议并行/替代安装 python 2.7。然后你可以用 2.7 版本的 python 解释器安装 pip。请参阅以下内容:

#sudo wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
#sudo python2.7 ez_setup.py
#easy_install-2.7 pip
#sudo pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl

回答by ComeOnGetMe

Try upgrade protobuf with pip install:

尝试使用 pip install 升级 protobuf:

sudo pip install --upgrade protobuf 
sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/protobuf-3.0.0b2.post2-cp27-none-any.whl

worked for me. The documentationhas provided many solutions for various installation problems.

为我工作。该文档为各种安装问题提供了许多解决方案。

回答by sam

I'm using ubuntu 12.04 64bits. I solve this issue by:

我正在使用 ubuntu 12.04 64 位。我通过以下方式解决了这个问题:

mkdir -p ~/code/download/lib/tensorflow/
cd ~/code/download/lib/tensorflow/
virtualenv --system-site-packages tensorflow_for_ubuntu12_04_64bit_python2_7
source tensorflow_for_ubuntu12_04_64bit_python2_7/bin/activate
cd tensorflow_for_ubuntu12_04_64bit_python2_7
pip install --upgrade tensorflow

回答by anthonys

the filename you are running sdist with must be named setup.pyrunning the file as say setup_something.pywill fail

您正在运行 sdist 的文件名必须命名为setup.py运行文件,因为说setup_something.py会失败