pycharm使用错误排查

1.pip安装扩展包报错

    creating build/temp.linux-x86_64-3.4
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include -I/usr/include/python3.4m -c _mssql.c -o build/temp.linux-x86_64-3.4/_mssql.o -DMSDBLIB
    _mssql.c:8:22: fatal error: pyconfig.h: No such file or directory
     #include "pyconfig.h"
                          ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
View Code

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

 安装扩展包

kamil@vm-ubuntu:~$ sudo apt-get install python3-dev
[sudo] password for kamil: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libexpat1-dev libpython3-dev libpython3.4 libpython3.4-dev python3.4-dev
The following NEW packages will be installed:
  libexpat1-dev libpython3-dev libpython3.4 libpython3.4-dev python3-dev
  python3.4-dev
0 upgraded, 6 newly installed, 0 to remove and 64 not upgraded.
Need to get 19.6 MB of archives.
After this operation, 36.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main libpython3.4 amd64 3.4.3-1ubuntu1~14.04.3 [1,308 kB]

 2.pip升级

kamil@vm-ubuntu:~$ sudo pip install --upgrade pip
[sudo] password for kamil: 
The directory '/home/kamil/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
You are using pip version 7.1.0, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The directory '/home/kamil/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
  Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
    100% |████████████████████████████████| 1.2MB 90kB/s 
Installing collected packages: pip
  Found existing installation: pip 7.1.0
    Uninstalling pip-7.1.0:
      Successfully uninstalled pip-7.1.0
Successfully installed pip-8.1.1
kamil@vm-ubuntu:~$ 

3.Command "python setup.py egg_info" failed with error code 1 in

请问

4.error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

You need to install the FreeTDS development package (freetds-dev) before trying to install pymssql with pip:
$ sudo apt-get install freetds-dev
sudo apt-get install -y libxml2-dev libxslt1-dev zlib1g-dev python3-pip
and then, in your virtualenv or wherever you wish to install it:
$ pip install pymssql
kamil@vm-ubuntu:~$ sudo pip install pymssql
The directory '/home/kamil/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/kamil/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pymssql
  Downloading pymssql-2.1.2.tar.gz (898kB)
    100% |████████████████████████████████| 901kB 59kB/s 
Installing collected packages: pymssql
  Running setup.py install for pymssql ... done
Successfully installed pymssql-2.1.2
kamil@vm-ubuntu:~$ 

 5.error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).

请问

 6.lxml安装报错

    compilation terminated.
    *********************************************************************************
    Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    *********************************************************************************
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
  Rolling back uninstall of lxml
Command "/usr/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-j1bywhpx/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('
', '
'), __file__, 'exec'))" install --record /tmp/pip-vz905g9u-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-j1bywhpx/lxml/
View Code

解决:

1 apt-get install libxml2-dev;
2 apt-get install libxslt1-dev;
3 sudo pip install lxml --upgrade

 7.MySQL-Python模块

sudo apt-get install libmysqlclient-dev
yum install python-devel mysql-devel
公众号请关注:侠之大者
原文地址:https://www.cnblogs.com/kamil/p/5523586.html