Hi,
Faced some compilation issues: any hints?
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/include/libxml2 -I/var/www/piati/pyenv/build/lxml/src/lxml/includes -I/usr/include/python3.3m -I/var/www/piati/pyenv/include/python3.3m -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-3.3/src/lxml/lxml.etree.o
src/lxml/lxml.etree.c:8:22: fatal error: pyconfig.h: No such file or directory
#include «pyconfig.h»
compilation terminated.
/usr/lib/python3.3/distutils/dist.py:257: UserWarning: Unknown distribution option: ‘bugtrack_url’
warnings.warn(msg)
error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1
Cleaning up…
Removing temporary dir /var/www/piati/pyenv/build…
Command /var/www/piati/pyenv/bin/python3.3 -c «import setuptools;file=’/var/www/piati/pyenv/build/lxml/setup.py’;exec(compile(open(file).read().replace(‘rn’, ‘n’), file, ‘exec’))» install —record /tmp/pip-ljykbz-record/install-record.txt —single-version-externally-managed —install-headers /var/www/piati/pyenv/include/site/python3.3 failed with error code 1 in /var/www/piati/pyenv/build/lxml
Exception information:
Traceback (most recent call last):
File «/var/www/piati/pyenv/lib/python3.3/site-packages/pip/basecommand.py», line 134, in main
status = self.run(options, args)
File «/var/www/piati/pyenv/lib/python3.3/site-packages/pip/commands/install.py», line 241, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File «/var/www/piati/pyenv/lib/python3.3/site-packages/pip/req.py», line 1298, in install
requirement.install(install_options, global_options, _args, *_kwargs)
File «/var/www/piati/pyenv/lib/python3.3/site-packages/pip/req.py», line 625, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File «/var/www/piati/pyenv/lib/python3.3/site-packages/pip/util.py», line 670, in call_subprocess
% (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command /var/www/piati/pyenv/bin/python3.3 -c «import setuptools;file=’/var/www/piati/pyenv/build/lxml/setup.py’;exec(compile(open(file).read().replace(‘rn’, ‘n’), file, ‘exec’))» install —record /tmp/pip-ljykbz-record/install-record.txt —single-version-externally-managed —install-headers /var/www/piati/pyenv/include/site/python3.3 failed with error code 1 in /var/www/piati/pyenv/build/lxml
I am setting up boost-python for the python bindings of a library. Previously, boost was installed but linked against python2.7. After some tribulations, everything from the previous boost install is gone and I am trying to install a fresh boost.
I am using Linux Mint for the record, and Anaconda with python 3.6.8.
It works correctly in the CLI : python —version gives 3.6.8
I then begin to follow the instructions for building boost : https://www.boost.org/users/history/version_1_69_0.html
What I got from other threads is to do this :
sudo apt-get install python3-dev
I am not sure I am supposed to since I have anaconda3 but anyway, I did it.
./bootstrap.sh
here the file project-config.jam is created and the line about python says :
using python : 3.6 : /home/myUser/anaconda3 ;
I then proceed to build with b2 :
sudo ./b2 --with-python -j8 install
the installation fails with literally a wall of text full of these :
./boost/python/detail/wrap_python.hpp:50:11: fatal error:
pyconfig.h: No such file or directory
# include <pyconfig.h>
^~~~~~~~~~~~
compilation terminated.
When I search inside ~/anaconda3/include/python3.6m the file pyconfig.h sits there as expected
Is there additional information I should give to b2 or bootstrap ?
EDIT :
first line given by ./b2 is :
warning: failed to open log file bin.v2/config.log for writing
after a few lines of checks :
config-cache.write bin.v2/project-cache.jam
/bin/sh: 2: cannot create bin.v2/project-cache.jam: Permission denied
...failed config-cache.write bin.v2/project-cache.jam...
...failed updating 1 target.
-
Python
в общем хотел поиграть с питоном для андроид. с kivy и buildozer
ввожу
buildozer -v android debug
и все падает на ошибке о ненахождение ‘pyconfig.h’
os: manjaro
-
Вопрос заданболее двух лет назад
-
316 просмотров
Комментировать
Пригласить эксперта
Ответы на вопрос 1
python3-dev пакет не установлен
.h файл заголовков обычно лежит в пакетах разработчика -dev
-
L
@leonid_073 Автор вопроса
нету такого пакета к сожалению(либо не нашел), хоть все и писали про то что надо его поставить
-
Дак он от версии питона зависит как бы. Ищите лучше.
-
Леонид, его нет, потому что он не установлен, очевидно.
-
L
@leonid_073 Автор вопроса
Ivan Yakushenko, ну эт понятно, что он не установлен. Я чет перерыл и не нашел
-
Леонид, так а что ты ищешь, если он не установлен, лол?
Установи его:
apt-get install python3-dev
-
L
@leonid_073 Автор вопроса
-
Леонид, ну так гугли как установить в маньяру python3-dev, или задавай соответствующий вопрос.
Похожие вопросы
-
Показать ещё
Загружается…
04 февр. 2023, в 21:37
4500 руб./за проект
04 февр. 2023, в 20:45
1000 руб./за проект
04 февр. 2023, в 20:04
35000 руб./за проект
Минуточку внимания
Hi Jorge, I am really sorry but I don't have any issue for the compilation of Python 3.6 under Windows 8.1 C:Userspydevcpython-bpo-35157>PCbuildamd64python.exe -m test.pythoninfo Python debug information ======================== Py_DEBUG: No (sys.gettotalrefcount() missing) _decimal.__libmpdec_version__: 2.4.2 builtins.float.double_format: IEEE, little-endian builtins.float.float_format: IEEE, little-endian datetime.datetime.now: 2018-11-04 14:18:35.618798 expat.EXPAT_VERSION: expat_2.2.6 locale.encoding: cp1252 os.cpu_count: 2 os.cwd: C:Userspydevcpython-bpo-35157 os.environ[COMSPEC]: C:Windowssystem32cmd.exe os.environ[HOMEDRIVE]: C: os.environ[HOMEPATH]: Userspydev os.environ[HOME]: C:Userspydev os.environ[LANG]: fr_BE.UTF-8 os.environ[PATH]: C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program FilesTortoiseHg;C:Program FilesTortoiseSVNbin;C:Program FilesGitcmd;C:Progr am FilesMicrosoft Windows Performance Toolkit;C:Program FilesGitbin;C:Program FilesMicrosoftWeb Platform Installer os.environ[PYTHON]: py -3.6 os.environ[TEMP]: C:UserspydevAppDataLocalTemp os.environ[TMP]: C:UserspydevAppDataLocalTemp os.environ[USERPROFILE]: C:Userspydev os.environ[VS100COMNTOOLS]: C:Program Files (x86)Microsoft Visual Studio 10.0Common7Tools os.environ[VS140COMNTOOLS]: C:Program Files (x86)Microsoft Visual Studio 14.0Common7Tools os.environ[VS90COMNTOOLS]: C:Program Files (x86)Microsoft Visual Studio 9.0Common7Tools os.login: pydev os.name: nt os.supports_bytes_environ: False os.supports_effective_ids: [] os.supports_fd: ['stat', 'truncate'] os.supports_follow_symlinks: ['stat'] os.umask: 000 platform.architecture: 64bit WindowsPE platform.platform: Windows-8.1 platform.python_implementation: CPython socket.hostname: win81bb sqlite3.sqlite_version: 3.21.0 sqlite3.version: 2.6.0 ssl.HAS_SNI: True ssl.OPENSSL_VERSION: OpenSSL 1.0.2p 14 Aug 2018 ssl.OPENSSL_VERSION_INFO: (1, 0, 2, 16, 15) ssl.OP_ALL: -0x7ffffc01 ssl.OP_NO_TLSv1_1: 0x10000000 sys.api_version: 1013 sys.builtin_module_names: ('_ast', '_bisect', '_blake2', '_codecs', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_collections', '_csv', '_datetime', '_functools', '_hea pq', '_imp', '_io', '_json', '_locale', '_lsprof', '_md5', '_multibytecodec', '_opcode', '_operator', '_pickle', '_random', '_sha1', '_sha256', '_sha3', '_sha512', '_signal', '_sre', '_stat', '_string', '_struct', '_symtable', '_thread', '_tracemalloc', '_warnings', '_weakref', '_winapi', 'array', 'atexit', 'audioop', 'binascii', 'builtins', 'cmath', 'errno', 'faulthandler', 'gc', 'itertools', 'marshal', 'math', 'mmap', 'm svcrt', 'nt', 'parser', 'sys', 'time', 'winreg', 'xxsubtype', 'zipimport', 'zlib') sys.byteorder: little sys.dont_write_bytecode: False sys.executable: C:Userspydevcpython-bpo-35157PCbuildamd64python.exe sys.filesystem_encoding: utf-8/surrogatepass sys.flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0) sys.float_info: sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, r ounds=1) sys.float_repr_style: short sys.hash_info: sys.hash_info(width=64, modulus=2305843009213693951, inf=314159, nan=0, imag=1000003, algorithm='siphash24', hash_bits=64, seed_bits=128, cutoff=0) sys.hexversion: 50726896 sys.implementation: namespace(cache_tag='cpython-36', hexversion=50726896, name='cpython', version=sys.version_info(major=3, minor=6, micro=7, releaselevel='final', serial=0)) sys.int_info: sys.int_info(bits_per_digit=30, sizeof_digit=4) sys.maxsize: 9223372036854775807 sys.maxunicode: 1114111 sys.path: ['', 'C:\Users\pydev\cpython-bpo-35157\PCbuild\amd64\python36.zip', 'C:\Users\pydev\cpython-bpo-35157\DLLs', 'C:\Users\pydev\cpython-bpo-35157\lib', 'C:\Users\pydev\cpython-bpo-35157\PC build\amd64', 'C:\Users\pydev\AppData\Roaming\Python\Python36\site-packages', 'C:\Users\pydev\cpython-bpo-35157', 'C:\Users\pydev\cpython-bpo-35157\lib\site-packages'] sys.platform: win32 sys.prefix: C:Userspydevcpython-bpo-35157 sys.stderr.encoding: utf-8/backslashreplace sys.stdin.encoding: utf-8/surrogateescape sys.stdout.encoding: utf-8/surrogateescape sys.thread_info: sys.thread_info(name='nt', lock=None, version=None) sys.version: 3.6.7+ (heads/3.6:4614b98, Nov 4 2018, 13:07:59) [MSC v.1900 64 bit (AMD64)] sys.version_info: sys.version_info(major=3, minor=6, micro=7, releaselevel='final', serial=0) sys.windowsversion: sys.getwindowsversion(major=6, minor=3, build=9600, platform=2, service_pack='') sys.winver: 3.6 sysconfig[prefix]: C:Userspydevcpython-bpo-35157 test_socket.HAVE_SOCKET_ALG: False test_socket.HAVE_SOCKET_CAN: False test_socket.HAVE_SOCKET_RDS: False test_support.IPV6_ENABLED: True test_support._is_gui_available: False test_support.python_is_optimized: False time.altzone: -3600 time.daylight: 0 time.get_clock_info(perf_counter): namespace(adjustable=False, implementation='QueryPerformanceCounter()', monotonic=True, resolution=1e-07) time.get_clock_info(time): namespace(adjustable=True, implementation='GetSystemTimeAsFileTime()', monotonic=False, resolution=0.015625) time.time: 1541341115.6187983 time.timezone: 0 time.tzname: ('Coordinated Universal Time', 'Coordinated Universal Time') tkinter.TCL_VERSION: 8.6 tkinter.TK_VERSION: 8.6 tkinter.info_patchlevel: 8.6.6 zlib.ZLIB_RUNTIME_VERSION: 1.2.11 zlib.ZLIB_VERSION: 1.2.11
surroundings
- ubuntu 16
- python3.5
Problem Description
In the python virtual environment, when installing the dlib library with pip, the error is as follows, the file cannot be found.<x86_64-linux-gnu/python3.5m/pyconfig.h>
fatal error: x86_64-linux-gnu/python3.5m/pyconfig.h: No such file or directory
# include <x86_64-linux-gnu/python3.5m/pyconfig.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
problem solved
Try 1
Install dlib in compiled mode as follows, the error remains
git clone https://github.com/davisking/dlib.git
cd dlib
mkdir build
cd build
cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1
cmake --build .
cd ..
python3 setup.py install --no DLIB_USE_CUDA
Try 2
Try to install the librarypython3.5-dev
The feedback shows that it has been installed and the error remains.
sudo apt-get install python3.5-dev
Try 3
Find the namepyconfig.h
document
sudo find / -name pyconfig.h
Found a file in the error prompt in the system<x86_64-linux-gnu/python3.5m/pyconfig.h>
May be a problem with the path.
/usr/include/python2.7/pyconfig.h
/usr/include/python3.5m/pyconfig.h
/usr/include/x86_64-linux-gnu/python2.7/pyconfig.h
/usr/include/x86_64-linux-gnu/python3.5m/pyconfig.h
Try 4
View the address of the python reference file in the current environment
python3.5-config --includes
The two are inconsistent, the former is the search path, and the path is the current path of the file.
-I/usr/include/python3.5m -I/usr/include/x86_64-linux-gnu/python3.5m
Copy files to search path
sudo cp /usr/include/x86_64-linux-gnu/python3.5m/pyconfig.h /usr/include/python3.5m/
View again
python3.5-config --includes
-I/usr/include/python3.5m -I/usr/include/python3.5m
Install again and pass.
reference
Я пытаюсь скомпилировать установщик Python 2.7 в Windows. Компиляция работает нормально, но когда я пытаюсь запустить
PCbuildpython.exe setup.py bdist_wininst
Я получаю сообщение об ошибке:
error: pyconfig.h: No such file or directory
Как я могу это исправить?
Обновление: я нашел файл с именем Pyconfig.h.in
в корневом каталоге. После переименования в Pyconfig.h
bdist завершается со следующей ошибкой:
Traceback (most recent call last):
File "setup.py", line 2076, in <module>
main()
File "setup.py", line 2071, in main
'Lib/smtpd.py']
File "Python-2.7.3libdistutilscore.py", line 152, in setup
dist.run_commands()
File "Python-2.7.3libdistutilsdist.py", line 953, in run_commands
self.run_command(cmd)
File "Python-2.7.3Python-2.7.3libdistutilsdist.py", line 972, in run_command
cmd_obj.run()
File "Python-2.7.3libdistutilscommandbdist_wininst.py", line 131, in run
self.run_command('build')
File "Python-2.7.3libdistutilscmd.py", line 326, in run_command
self.distribution.run_command(command)
File "Python-2.7.3libdistutilsdist.py", line 972, in run_command
cmd_obj.run()
File "Python-2.7.3libdistutilscommandbuild.py", line 127, in run
self.run_command(cmd_name)
File "Python-2.7.3libdistutilscmd.py", line 326, in run_command
self.distribution.run_command(command)
File "Python-2.7.3libdistutilsdist.py", line 972, in run_command
cmd_obj.run()
File "Python-2.7.3libdistutilscommandbuild_ext.py", line 339, in run
self.build_extensions()
File "setup.py", line 152, in build_extensions
missing = self.detect_modules()
File "setup.py", line 1146, in detect_modules
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
AttributeError: 'NoneType' object has no attribute 'split'
Заранее спасибо, Иван.
Имея некоторые проблемы, теперь я прочитал следующее:
Привет, мир Python расширение в C ++, используя Boost?
Я попытался установить надстройку на мой рабочий стол, и, как указано в сообщениях, предложенных с точки зрения ссылок. У меня есть следующий код:
#include <boost/python.hpp>
#include <Python.h>
using namespace boost::python;
Теперь я попытался связать со следующим:
g++ testing.cpp -I /usr/include/python2.7/pyconfig.h -L /usr/include/python2.7/Python.h
-lpython2.7
И я попробовал следующее:
g++ testing.cpp -I /home/username/python/include/ -L /usr/include/python2.7/Python.h -lpython2.7
Я продолжаю получать следующую ошибку:
/usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such
file or directory
# include <pyconfig.h>
Я не знаю, где я иду не так. У меня установлен boost.python, просто проблема с линковкой?
32
Решение
У меня была такая же ошибка, проблема в том, что g ++ не может найти pyconfig.h (шокирует, я знаю). Для меня этот файл находится в /usr/include/python2.7/pyconfig.h
так добавляя -I /usr/include/python2.7/
должен исправить это, в качестве альтернативы вы можете добавить каталог к вашему пути с помощью:
export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/include/python2.7/"
Вы также можете добавить это в ваш .bashrc, и он будет добавлен всякий раз, когда вы в следующий раз запустите свою оболочку (вам нужно будет снова открыть свой терминал, чтобы реализовать изменения).
Вы можете найти свой собственный путь включения Python, используя find /usr/include -name pyconfig.h
в моем случае это возвращает:
/usr/include/python2.7/pyconfig.h
/usr/include/i386-linux-gnu/python2.7/pyconfig.h
61
Другие решения
Есть две возможные причины этого симптома: 1. у вас не установлен python-dev. 2. у вас установлен python-dev, и ваш путь включения неверно настроен, что вышеизложенная публикация обеспечивает решение. В моем случае я устанавливал boost, и он ищет заголовочный файл pyconfig.h, который отсутствует в моем Ubuntu:
Решение
apt-get install python-dev
В других версиях Linux вы должны выяснить, как установить заголовок Python.
11
Если у тебя есть .c
файл (hello.c
) и вы хотите построить libhello.so
библиотека, попробуйте:
find /usr/include -name pyconfig.h
[из]:
/usr/include/python2.7/pyconfig.h
/usr/include/x86_64-linux-gnu/python2.7/pyconfig.h
затем используйте вывод и выполните:
gcc -shared -o libhello.so -fPIC hello.c -I /usr/include/python2.7/
Если вы конвертируете из Python .pyx в .so, попробуйте этот модуль python, он автоматически создаст .so файл с учетом файла .pyx:
def pythonizing_cython(pyxfile):
import os
# Creates ssetup_pyx.py file.
setup_py = "n".join(["from distutils.core import setup",
"from Cython.Build import cythonize",
"setup(ext_modules = cythonize('"+
pyxfile+".pyx'))"])
with open('setup_pyx.py', 'w') as fout:
fout.write(setup_py)
# Compiles the .c file from .pyx file.
os.system('python setup_pyx.py build_ext --inplace')
# Finds the pyconfig.h file.
pyconfig = os.popen('find /usr/include -name pyconfig.h'
).readline().rpartition('/')[0]
# Builds the .so file.
cmd = " ".join(["gcc -shared -o", pyxfile+".so",
"-fPIC", pyxfile+".c",
"-I", pyconfig])
os.system(cmd)
# Removing temporary .c and setup_pyx.py files.
os.remove('setup_pyx.py')
os.remove(pyxfile+'.c')
7
У меня был похожий опыт при создании наддува для centos7. Я не смог найти pyconfig.h в моей системе только pyconfig-64.h.
После поиска я обнаружил, что вам нужно установить python-devel, чтобы получить pyconfig.h
7