Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x Python3正确安装PyCurl_Python 3.x_Pycurl - Fatal编程技术网

Python 3.x Python3正确安装PyCurl

Python 3.x Python3正确安装PyCurl,python-3.x,pycurl,Python 3.x,Pycurl,我试图在我的ubuntu16.04 LTS上安装pycurl,该模块看起来已安装,但当我尝试从python导入它时,它给了我“没有名为pycurl的模块”。 我的python3版本是3.7.8 pip3冻结| grep pycurl告诉我安装了7.43版pycurl==7.43.0 我已成功运行: apt-get update apt-get install python3-pycurl python3-m pip安装pycurl给了我: Defaulting to user installa

我试图在我的
ubuntu16.04 LTS
上安装
pycurl
,该模块看起来已安装,但当我尝试从python导入它时,它给了我“没有名为pycurl的模块”。 我的python3版本是
3.7.8

pip3冻结| grep pycurl
告诉我安装了7.43版
pycurl==7.43.0

我已成功运行:

apt-get update
apt-get install python3-pycurl
python3-m pip安装pycurl
给了我:

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pycurl in /usr/lib/python3/dist-packages (7.43.0)
python3-m easy\u install pycurl
返回:

WARNING: The easy_install command is deprecated and will be removed in a future version.
Searching for pycurl
Best match: pycurl 7.43.0
Adding pycurl 7.43.0 to easy-install.pth file

Using /usr/lib/python3/dist-packages
Processing dependencies for pycurl
Finished processing dependencies for pycurl
在所有这些之后,我在尝试导入模块时得到以下信息:

>>> import pycurl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pycurl'
#更新2: 我运行这些命令:
sudo apt get purge python3 pycurl
然后
pip3 freeze | grep pycurl
不返回任何内容=>pycurl被卸载

然后,我运行
pip3安装pycurl

pip3 install pycurl
Defaulting to user installation because normal site-packages is not 
writeable
Collecting pycurl
Using cached pycurl-7.43.0.5.tar.gz (216 kB)
Building wheels for collected packages: pycurl
Building wheel for pycurl (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; 
sys.argv[0] = '"'"'/tmp/pip-install-umytzbub/pycurl/setup.py'"'"'; 
__file__='"'"'/tmp/pip-install- 
umytzbub/pycurl/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-31uhzig0
   cwd: /tmp/pip-install-umytzbub/pycurl/
Complete output (18 lines):
Using curl-config (libcurl 7.47.0)
Using SSL library: GnuTLS
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/curl
copying python/curl/__init__.py -> build/lib.linux-x86_64-3.7/curl
running build_ext
building 'pycurl' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare - 
DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat - 
Werror=format-security -g -fstack-protector-strong -Wformat - 
Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC - 
DPYCURL_VERSION="7.43.0.5" -DHAVE_CURL_SSL=1 -DHAVE_CURL_GNUTLS=1 - 
DHAVE_CURL_SSL=1 -I/usr/include/python3.7m -c src/docstrings.c -o 
build/temp.linux-x86_64-3.7/src/docstrings.o
In file included from src/docstrings.c:4:0:
src/pycurl.h:5:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pycurl
Running setup.py clean for pycurl
Failed to build pycurl
DEPRECATION: Could not build wheels for pycurl which do not use PEP 
517. pip will fall back to legacy 'setup.py install' for these. pip 
21.0 will remove support for this functionality. A possible 
replacement is to fix the wheel build issue reported above. You can 
find discussion regarding this at 
https://github.com/pypa/pip/issues/8368.
Installing collected packages: pycurl
Running setup.py install for pycurl ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; 
sys.argv[0] = '"'"'/tmp/pip-install-umytzbub/pycurl/setup.py'"'"'; 
__file__='"'"'/tmp/pip-install- 
umytzbub/pycurl/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-62fg7a92/install- 
record.txt --single-version-externally-managed --user --prefix= -- 
compile --install-headers 
/home/user/.local/include/python3.7m/pycurl
     cwd: /tmp/pip-install-umytzbub/pycurl/
Complete output (18 lines):
Using curl-config (libcurl 7.47.0)
Using SSL library: GnuTLS
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/curl
copying python/curl/__init__.py -> build/lib.linux-x86_64-3.7/curl
running build_ext
building 'pycurl' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare - 
DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat - 
Werror=format-security -g -fstack-protector-strong -Wformat - 
Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC - 
DPYCURL_VERSION="7.43.0.5" -DHAVE_CURL_SSL=1 -DHAVE_CURL_GNUTLS=1 - 
DHAVE_CURL_SSL=1 -I/usr/include/python3.7m -c src/docstrings.c -o 
build/temp.linux-x86_64-3.7/src/docstrings.o
In file included from src/docstrings.c:4:0:
src/pycurl.h:5:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u - 
c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip- 
install-umytzbub/pycurl/setup.py'"'"'; __file__='"'"'/tmp/pip- 
install-umytzbub/pycurl/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-62fg7a92/install- 
record.txt --single-version-externally-managed --user --prefix= -- 
compile --install-headers 
/home/user/.local/include/python3.7m/pycurl Check the logs for full 
command output.

我最终通过安装
libpython3.7-dev

sudo apt-get install libpython3.7-dev

请尝试以下回答URL:并让我知道答案。@ViswanathPolaki你是什么意思?是否使用pip进行安装?如问题所示,我已经试过了,但不起作用。pydocusign给了我2.2版,在测试时使用python3而不是python。hi@D.SM,你是什么意思?我总是用蟒蛇3好的。删除您添加的两个pycurl安装,然后选择是否要使用apt或pip,一次性安装pycurl,使用结果更新问题。
sudo apt-get install libpython3.7-dev