ubuntu虚拟机中的fdfs-client-py-master.zip的正确安装

fdfs_client-py-master.zip安装

可以使用pip直接安装 pip install fdfs-client-py

下载zip包,到下载目录中,pip install fdfs-client-py-master.zip

当我们在Ubuntu的虚拟机中安装fdfs_client-py-master.zip遇到这样的错误

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Processing ./fdfs_client-py-master.zip
Building wheels for collected packages: fdfs-client-py
Running setup.py bdist_wheel for fdfs-client-py ... error
Complete output from command /home/python/.virtualenvs/meiduo/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-ccsx7jn1/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-850454wf --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/utils.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/exceptions.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/tracker_client.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/fdfs_test.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/connection.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/fdfs_protol.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/__init__.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/storage_client.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/client.py -> build/lib.linux-x86_64-3.6/fdfs_client
running build_ext
building 'fdfs_client.sendfile' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/fdfs_client
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.6m -I/home/python/.virtualenvs/meiduo/include/python3.6m -c fdfs_client/sendfilemodule.c -o build/temp.linux-x86_64-3.6/fdfs_client/sendfilemodule.o
fdfs_client/sendfilemodule.c:43:20: fatal error: Python.h: 没有那个文件或目录
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Failed building wheel for fdfs-client-py
Running setup.py clean for fdfs-client-py
Failed to build fdfs-client-py
Installing collected packages: fdfs-client-py
Running setup.py install for fdfs-client-py ... error
Complete output from command /home/python/.virtualenvs/meiduo/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-ccsx7jn1/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-3yandvc8/install-record.txt --single-version-externally-managed --compile --install-headers /home/python/.virtualenvs/meiduo/include/site/python3.6/fdfs-client-py:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/utils.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/exceptions.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/tracker_client.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/fdfs_test.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/connection.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/fdfs_protol.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/__init__.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/storage_client.py -> build/lib.linux-x86_64-3.6/fdfs_client
copying fdfs_client/client.py -> build/lib.linux-x86_64-3.6/fdfs_client
running build_ext
building 'fdfs_client.sendfile' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/fdfs_client
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.6m -I/home/python/.virtualenvs/meiduo/include/python3.6m -c fdfs_client/sendfilemodule.c -o build/temp.linux-x86_64-3.6/fdfs_client/sendfilemodule.o
fdfs_client/sendfilemodule.c:43:20: fatal error: Python.h: 没有那个文件或目录
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Command "/home/python/.virtualenvs/meiduo/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-ccsx7jn1/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-3yandvc8/install-record.txt --single-version-externally-managed --compile --install-headers /home/python/.virtualenvs/meiduo/include/site/python3.6/fdfs-client-py" failed with error code 1 in /tmp/pip-req-build-ccsx7jn1/

解决办法

sudo apt-get install python3.6-dev

原因

和我们使用虚拟环境有关系,导致版本不统一。

小伟科技 wechat
python爱好者公众号—每日学习python必备
欢迎打赏支持!