python - 为什么“pip install”会在 setup.py 中引发 SyntaxError?
问题描述
我试图通过 pip 安装一个 python 包,它在 setup.py 中引发了一个 SyntaxError:
$ /usr/bin/pip install dash --user
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting dash
Using cached https://files.pythonhosted.org/packages/ad/94/c591c1ff695c32e7fc5138525f3a792d289160008f1a7f517860cc744a85/dash-0.26.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-ysGuJO/dash/setup.py", line 5, in <module>
exec(open('dash/version.py').read(), main_ns) # pylint: disable=exec-used
File "<string>", line 1
__version__ = '0.26.5'
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ysGuJO/dash/
You are using pip version 7.1.0, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
我在这里做错了什么?我想这与太旧的 python 版本有关:
$ python --version
Python 2.6.6
由于响应与此类似,因此有关 stackoverflow 的更具体问题和
pip install urllib3
工作正常,只需要> = Python 2.6。
解决方案
这是由于旧版本的 python 造成的问题。你可能需要升级你的python。升级后您将不会遇到任何问题。以下是升级步骤。在终端中编写步骤。
# refreshing the repositories
sudo apt update
# its wise to keep the system up to date!
# you can skip the following line if you not
# want to update all your software
sudo apt upgrade
# installing python 2.7 and pip for it
sudo apt install python2.7 python-pip
# installing python-pip for 3.6
sudo apt install python3-pip
推荐阅读
- javafx - 如何获取用户点击java fx的x和y
- javascript - 如何在 javascript 中获取这种特定的日期时间格式
- c++ - Rcpp,使函数可以从 DLL 中用于 R
- html - 如何让我的“查看更多”(“seemorelink”)链接更靠近我的图像?
- angular - 以角度 6 反应形式处理数字输入类型,例如电话或时间?
- java - 如何在 Java 中实现 Graphic2D 对象的颜色变化?
- c - 在汇编 x86 中交换 2 个整数
- treeview - 网络树不集中
- google-cloud-storage - 如何正确授权对 Google Cloud Storage API 的请求?
- c - 如何检测管道输入的缺失