Python 错误:'egg_base' 选项中的错误:'src' 不存在或不是目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50755705/
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 19:35:36  来源:igfitidea点击:

error: error in 'egg_base' option: 'src' does not exist or is not a directory

pythonpippycharmsrc

提问by qtwolf

I'm trying to install Python packaging tools in Pycharm CE Ubuntu 18.04 and this error occurs.

我正在尝试在 Pycharm CE Ubuntu 18.04 中安装 Python 打包工具,但发生此错误。

Excuted command: /tmp/tmpl3kyfibgpycharm-management/pip-10.0.1/setup.py install

执行命令: /tmp/tmpl3kyfibgpycharm-management/pip-10.0.1/setup.py install

Error ocurred: error: error in 'egg_base' option: 'src' does not exist or is not a directory

发生错误: error: error in 'egg_base' option: 'src' does not exist or is not a directory

Command output:

命令输出:

running install
running bdist_egg
error: error in 'egg_base' option: 'src' does not exist or is not a directory

I also tried pip install srcand this does not work either.

我也试过了pip install src,这也不起作用。

回答by Abhishek

For python 3 you must install it using

对于python 3,您必须使用安装它

sudo apt-get install python3-pip

sudo apt-get install python3-pip

it will work for python 2.7

它适用于python 2.7

sudo apt-get install python-pip

sudo apt-get install python-pip

回答by carroTsai

When choose the route of Project Interpreter, you'd better select the route '/usr/bin/python3'instead of '/usr/bin/python3.6'.

选择 Project Interpreter 的路径时,最好选择路径'/usr/bin/python3'而不是'/usr/bin/python3.6'.

回答by jozefow

I got similar problem when running setup.py by jython from outside of setup.py folder (just like your case). I don't know the root cause but when you change folder to where setup.py and scr folder is, installation completes.

在 setup.py 文件夹之外通过 jython 运行 setup.py 时我遇到了类似的问题(就像你的情况一样)。我不知道根本原因,但是当您将文件夹更改为 setup.py 和 scr 文件夹所在的位置时,安装完成。

cd /tmp/tmpl3kyfibgpycharm-management/pip-10.0.1
python setup.py install

回答by user11507396

Change your interpreter to (VENV) instead of User

将您的解释器更改为 (VENV) 而不是 User

回答by onofricamila

Just changed my interpreter to VENV (a virtual one) as user11507396 stated and it worked. If you are using PyCharm, you can do it as follows:

正如 user11507396 所说,刚刚将我的解释器更改为 VENV(虚拟解释器)并且它起作用了。如果您使用的是 PyCharm,您可以按如下方式进行:

  1. Go to Settings -> Project Interpreter -> Add List item

  2. Choose whatever you need. In my case choosing python3 as the base interpreter solved the question issue. enter image description here

  1. 转到设置 -> 项目解释器 -> 添加 项目清单

  2. 选择您需要的任何东西。在我的情况下,选择 python3 作为基本解释器解决了这个问题。 在此处输入图片说明