自带的python3是咋回事啊?
Tofloor
poster avatar
qsnow6
deepin
2016-08-19 02:09
Author
本帖最后由 qsnow6 于 2016-8-18 18:10 编辑

系统环境:deepin 64位
问题描述:安装第三方库scrapy的时候老是报GCC的错误,怎么都安装不上。
尝试在自带的python3中安装scrapy:
  1. sudo python3 -m pip install scrapy
Copy the Code

结果始终报以下错误:
zed@zed-pc:~/myproject$ sudo python3 -m pip install scrapy
Collecting scrapy
  Using cached Scrapy-1.1.1-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): lxml in /usr/lib/python3/dist-packages (from scrapy)
Collecting pyOpenSSL (from scrapy)
  Using cached pyOpenSSL-16.0.0-py2.py3-none-any.whl
Collecting parsel>=0.9.3 (from scrapy)
  Using cached parsel-1.0.3-py2.py3-none-any.whl
Collecting Twisted>=10.0.0 (from scrapy)
  Using cached Twisted-16.3.1.tar.bz2
Requirement already satisfied (use --upgrade to upgrade): w3lib>=1.14.2 in /usr/local/lib/python3.5/dist-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in /usr/lib/python3/dist-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): cssselect>=0.9 in /usr/local/lib/python3.5/dist-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): PyDispatcher>=2.0.5 in /usr/local/lib/python3.5/dist-packages (from scrapy)
Collecting service-identity (from scrapy)
  Using cached service_identity-16.0.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): queuelib in /usr/local/lib/python3.5/dist-packages (from scrapy)
Collecting cryptography>=1.3 (from pyOpenSSL->scrapy)
  Using cached cryptography-1.4.tar.gz
Collecting zope.interface>=4.0.2 (from Twisted>=10.0.0->scrapy)
  Using cached zope.interface-4.2.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pyasn1 in /usr/local/lib/python3.5/dist-packages (from service-identity->scrapy)
Requirement already satisfied (use --upgrade to upgrade): attrs in /usr/local/lib/python3.5/dist-packages (from service-identity->scrapy)
Requirement already satisfied (use --upgrade to upgrade): pyasn1-modules in /usr/local/lib/python3.5/dist-packages (from service-identity->scrapy)
Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in /usr/local/lib/python3.5/dist-packages (from cryptography>=1.3->pyOpenSSL->scrapy)
Requirement already satisfied (use --upgrade to upgrade): setuptools>=11.3 in /usr/local/lib/python3.5/dist-packages (from cryptography>=1.3->pyOpenSSL->scrapy)
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.4.1 in /usr/local/lib/python3.5/dist-packages (from cryptography>=1.3->pyOpenSSL->scrapy)
Requirement already satisfied (use --upgrade to upgrade): pycparser in /usr/local/lib/python3.5/dist-packages (from cffi>=1.4.1->cryptography>=1.3->pyOpenSSL->scrapy)
Installing collected packages: cryptography, pyOpenSSL, parsel, zope.interface, Twisted, service-identity, scrapy
  Running setup.py install for cryptography ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-h1z0dqj0/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-dntuijnj-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/cryptography
...............
    running egg_info
    writing entry points to src/cryptography.egg-info/entry_points.txt
    writing requirements to src/cryptography.egg-info/requires.txt
    writing top-level names to src/cryptography.egg-info/top_level.txt
    writing src/cryptography.egg-info/PKG-INFO
    writing dependency_links to src/cryptography.egg-info/dependency_links.txt
    warning: manifest_maker: standard file '-c' not found
   
    reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    no previously-included directories found matching 'docs/_build'
    warning: no previously-included files matching '*' found under directory 'vectors'
    writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
    running build_ext
    generating cffi module 'build/temp.linux-x86_64-3.5/_padding.c'
    creating build/temp.linux-x86_64-3.5
    generating cffi module 'build/temp.linux-x86_64-3.5/_constant_time.c'
    generating cffi module 'build/temp.linux-x86_64-3.5/_openssl.c'
    building '_openssl' extension
    creating build/temp.linux-x86_64-3.5/build
    creating build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c build/temp.linux-x86_64-3.5/_openssl.c -o build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5/_openssl.o
    build/temp.linux-x86_64-3.5/_openssl.c:429:30: fatal error: openssl/opensslv.h: 没有那个文件或目录
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
   
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-h1z0dqj0/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-dntuijnj-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-h1z0dqj0/cryptography/


尝试方案过的方案:

  1. sudo apt-get install gcc libffi-devel python-devel openssl-devel
  2. sudo python3 -m pip install setuptools
  3. sudo apt-get install python-dev
  4. sudo apt-get install python3-dev
  5. sudo apt-get install python3.4-dev
Copy the Code
还有其它方案记不清了,折腾了一整天,这环境弄的我崩溃了
求分析原因,刚从ubuntu滚过来,感觉这是linux和windows最接近的距离了。不想滚回ubuntu啊。。。。。



Reply Favorite View the author
All Replies
avatar
Lyvnee
deepin
2016-08-19 02:36
#1
  1. sudo apt install libssl-dev
Copy the Code
Reply View the author
Comments
qsnow6
2016-08-20 01:13
有用!感谢。
avatar
ochipedeepin
deepin
2016-08-20 01:29
#2
这个巨坑,我折腾了半晚上,没弄好,显示缺一个包,我安装那个包,没有,然后换成ubuntu,分分钟钟好了
Reply View the author
Comments
qsnow6
2016-08-20 01:44
解决了,确实是个巨坑!原来是系统少了个libssl-dev模块。。。。