博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
在python中遇到的问题
阅读量:3977 次
发布时间:2019-05-24

本文共 3031 字,大约阅读时间需要 10 分钟。

  1. 问题1:无法安装pymysql

报错的内容如下:

Collecting pymssql
Using cached https://files.pythonhosted.org/packages/2e/81/99562b93d75f3fc5956fa65decfb35b38a4ee97cf93c1d0d3cb799fffb99/pymssql-2.1.4.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: /usr/local/lib/python3.7/site-packages/setuptools/dist.py:46: DistDeprecationWarning: Do not call this function
warnings.warn(“Do not call this function”, DistDeprecationWarning)
Traceback (most recent call last):
File “”, line 1, in
File “/private/var/folders/2s/k44kn91x32gdprpz8qxpg_7r0000gn/T/pip-install-zriyazsw/pymssql/setup.py”, line 88, in
from Cython.Distutils import build_ext as _build_ext
ModuleNotFoundError: No module named ‘Cython’
----------------------------------------
ERROR: Command “python setup.py egg_info” failed with error code 1 in /private/var/folders/2s/k44kn91x32gdprpz8qxpg_7r0000gn/T/pip-install-zriyazsw/pymssql/

解决的办法如下:

xhj@localhost:~/Documents $ pip3 install Cython                                                                                                                                  Collecting Cython  Downloading https://files.pythonhosted.org/packages/62/13/2ed2e2005afb114ffe08fbd25d890e3795ca86cebf11c97ff8877da58f28/Cython-0.29.13-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (2.9MB)     |████████████████████████████████| 2.9MB 57kB/s Installing collected packages: CythonSuccessfully installed Cython-0.29.13xhj@localhost:~/Documents $ pip3 install pymysqlCollecting pymysql  Using cached https://files.pythonhosted.org/packages/ed/39/15045ae46f2a123019aa968dfcba0396c161c20f855f11dea6796bcaae95/PyMySQL-0.9.3-py2.py3-none-any.whlInstalling collected packages: pymysqlSuccessfully installed pymysql-0.9.3

出现的原因:

1、因为里面说我缺少Cython库,所以按照提示安装后,再执行安装pymysql就可以了

2、我一开始下载的不是pymasql 是pymssql,暂时还没弄明白两者的区别,只是听python开发说常用的是pymysql 所以就换了

  1. 问题2 使用pip命令报错
xhj@localhost:~ $ pip install pymssqlzsh: command not found: pipxhj@localhost:~ $ python3                                                Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) [Clang 6.0 (clang-600.0.57)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> pip install pymssql  File "
", line 1 pip install pymssql ^SyntaxError: invalid syntax>>> KeyboardInterrupt>>> exitUse exit() or Ctrl-D (i.e. EOF) to exit>>> exitUse exit() or Ctrl-D (i.e. EOF) to exit>>> exit() File "
", line 1 exit() ^SyntaxError: invalid character in identifier>>> exit()xhj@localhost:~ $ pip --versionzsh: command not found: pip

出于小白,我曾尝试在python内使用pip命令,也尝试在外部使用命令,但是都报错,然后我想我后面自己装了一个python3 ,所以尝试用pip3来执行一下,果然被我搞对了

xhj@localhost:~/Documents/py/dw_monitor (master) $ pip3 --version                                                                                                                2 ↵pip 19.1.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)xhj@localhost:~/Documents/py/dw_monitor (master) $ pip3 install pymssql

转载地址:http://virki.baihongyu.com/

你可能感兴趣的文章
AJAX 基础
查看>>
JSON 基础
查看>>
J2EE监听器Listener接口大全[转]
查看>>
cookie、session、sessionid 与jsessionid[转]
查看>>
常见Oracle HINT的用法
查看>>
JAVA中各类CACHE机制实现的比较 [转]
查看>>
PL/SQL Developer技巧
查看>>
3-python之PyCharm如何新建项目
查看>>
15-python之while循环嵌套应用场景
查看>>
17-python之for循环
查看>>
18-python之while循环,for循环与else的配合
查看>>
19-python之字符串简单介绍
查看>>
20-python之切片详细介绍
查看>>
P24-c++类继承-01详细的例子演示继承的好处
查看>>
P8-c++对象和类-01默认构造函数详解
查看>>
P1-c++函数详解-01函数的默认参数
查看>>
P3-c++函数详解-03函数模板详细介绍
查看>>
P4-c++函数详解-04函数重载,函数模板和函数模板重载,编译器选择使用哪个函数版本?
查看>>
P5-c++内存模型和名称空间-01头文件相关
查看>>
P6-c++内存模型和名称空间-02存储连续性、作用域和链接性
查看>>