在python中遇到的问题

  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: Cython
Successfully installed Cython-0.29.13
xhj@localhost:~/Documents $ pip3 install pymysql
Collecting pymysql
  Using cached https://files.pythonhosted.org/packages/ed/39/15045ae46f2a123019aa968dfcba0396c161c20f855f11dea6796bcaae95/PyMySQL-0.9.3-py2.py3-none-any.whl
Installing collected packages: pymysql
Successfully installed pymysql-0.9.3

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

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

  1. 问题2 使用pip命令报错
xhj@localhost:~ $ pip install pymssql
zsh: command not found: pip
xhj@localhost:~ $ python3                                                
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> pip install pymssql
  File "<stdin>", line 1
    pip install pymssql
              ^
SyntaxError: invalid syntax
>>> 
KeyboardInterrupt
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> exit()
  File "<stdin>", line 1
    exit()
         ^
SyntaxError: invalid character in identifier
>>> exit()
xhj@localhost:~ $ pip --version
zsh: 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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用\[1\]: 运行Faster-RCNN时出现 ModuleNotFoundError: No module named ‘lib.utils.cython_bbox’。引用\[2\]: 解决这个问题的流程是首先修改Faster-RCNN-TensorFlow-Python3\data\coco\PythonAPI\setup.py文件,在第15行加上一个Extension,指定了lib.utils.cython_bbox的路径和编译参数。然后生成cython_bbox.c和cython_bbox.pyx文件,并将它们改名为bbox.c和bbox.pyx。最后,在./data/coco/PythonAPI目录下运行python setup.py build_ext --inplace和python setup.py build_ext install命令。引用\[3\]: 运行Faster-RCNN时出现 ModuleNotFoundError: No module named 'lib.utils.cython_bbox'。解决这个问题的流程是首先修改Faster-RCNN-TensorFlow-Python3\data\coco\PythonAPI\setup.py文件,在第15行加上一个Extension,指定了lib.utils.cython_bbox的路径和编译参数。然后,在Faster-RCNN-TensorFlow-Python3\lib\utils目录下生成bbox.c和bbox.pyx文件。最后,在./data/coco/PythonAPI目录下运行python setup.py build_ext --inplace和python setup.py build_ext install命令。根据你提供的信息,你可以尝试按照这个流程来解决ModuleNotFoundError: No module named 'Cython.Plex.Transitions'的问题。 #### 引用[.reference_title] - *1* *2* *3* [运行Faster-RCNN时出现 ModuleNotFoundError: No module named ‘lib.utils.cython_bbox](https://blog.csdn.net/mao_hui_fei/article/details/120588340)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值