it-source

페이지 gem을 설치할 수 없습니다.

criticalcode 2023. 5. 31. 16:02
반응형

페이지 gem을 설치할 수 없습니다.

사용해 보았습니다.gem install pg하지만 효과가 없는 것 같습니다.

gem install pg이 오류를 제공합니다.

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

C:/Ruby/bin/ruby.exe extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby/bin/ruby
        --with-pg
        --without-pg
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/lib
        --with-pg-config
        --without-pg-config
        --with-pg_config
        --without-pg_config


Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/pg-0.10.1 for
inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/pg-0.10.1/ext/gem_make.out

저는 이런 문제가 있었고, 이것은 저에게 효과가 있었습니다.

postgresql-devel 패키지를 설치하면 pg_config 누락 문제가 해결됩니다.

sudo apt-get install libpq-dev

문제는 보석 의존성이므로 pg를 설치하기 전에 "libpq-dev"를 설치했는지 확인하십시오.

Ubuntu 시스템:

sudo apt-get install libpq-dev

RHEL 시스템:

yum 설치 postgresql-devel

Mac:

brew 설치 postgresql

gem install pg -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config

@윈필드가 말했습니다.

페이지 보석을 바인딩하려면 postgresql 클라이언트 라이브러리가 필요합니다.이 오류는 일반적으로 Postgres 라이브러리를 찾을 수 없음을 의미합니다.설치되어 있지 않거나 다음을 통과해야 할 수도 있습니다.--with-pg-dir=당신의 보석 설치에.

그 이상으로, 당신은 단지--with-pg-config=설치할 수 있습니다.

Mac에서

만약, 만약 당신이 mac의 웹사이트 번들을 통해서도 포스트그를 설치한다면, 그것은 다음과 같은 곳에 있을 것입니다./Applications/Postgres.app/Contents/Versions/9.3/bin.

따라서 Gem 설치를 통해 전달할 수를 수행합니다.

gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config

또는 PATH를 올바르게 설정합니다.이는 너무 많을 수 있으므로 일시적으로 PATH를 설정하는 것은 다음과 같습니다.

export PATH=%PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin/

제 경우에는 효과가 있었습니다.

sudo apt-get install libpq-dev

사용:

  • Ubuntu 14.04.2 LTS
  • 루비 2.2.2
  • 레일 4.2.1

나는 postgresql을 설치하지 않았기 때문에 그냥 사용하여 설치했습니다.

sudo apt-get install postgresql postgresql-server-dev-9.1

Ubuntu 12.04에서.

이것으로 해결되었습니다.


업데이트:

최신 버전 사용:

sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3

답변: Windows에 페이지젬을 설치할 수 없습니다.

어제 출시된 최신 버전의 pg(0.10.0) Windows 네이티브 버전은 없지만 0.9.0을 설치하면 바이너리를 문제 없이 설치해야 합니다.

Mac에서 Postgres.app을 사용하는 경우 다음과 같이 이 문제를 한 번만 해결할 수 있습니다.

첫번째gem uninstall pg그런 다음 편집합니다.~/.bash_profile또는~/.zshrc파일 또는 동등한 파일 및 추가:

# PostgreSQL bin path
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin

그리고나서bundle install그리고.gem install pg둘 다 예상대로 작동할 경우.

$ PATH=$PATH:/Library/PostgreSQL/9.1/bin sudo gem install pg

시스템에 설치된 버전의 9.1을 교체합니다.

macOS(엘 캐피탄)에서.다음을 간단히 사용할 수 있습니다.brew install postgresql

  • Ubuntu 20.10(팝!_os)
  • 루비 2.7.2
  • 레일 3.1.0
  • Postgresql 12

제거한 후 다시 설치postgresql-client libpq5 libpq-dev

sudo apt remove postgresql-client libpq5 libpq-dev
sudo apt install postgresql-client libpq5 libpq-dev

그런 다음 을 설치합니다.pg다시 가리키는 보석/usr/lib찾기 위해pg라이브러리:

gem install pg  --   --with-pg-lib=/usr/lib

출력(이전 명령 뒤에 표시해야 하는 내용):

Building native extensions with: '--with-pg-lib=/usr/lib'
This could take a while...
Successfully installed pg-1.2.3
Parsing documentation for pg-1.2.3
Installing ri documentation for pg-1.2.3
Done installing documentation for pg after 1 seconds
1 gem installed

Gem을 설치한 후 정상적으로 계속 진행해야 합니다.bundle설치 또는 업데이트:

bundle
bundle install
bundle update

페이지 보석을 바인딩하려면 postgresql 클라이언트 라이브러리가 필요합니다.이 오류는 일반적으로 Postgres 라이브러리를 찾을 수 없음을 의미합니다.설치되어 있지 않거나 --with-pg-message=를 보석 설치에 전달해야 할 수도 있습니다.

Mac 사용자용

PATH=$PATH:/Library/PostgreSQL/9.4/bin/ gem install pg

이것이 효과가 있을 것입니다.

와 함께 사용ARCH 깃발

sudo env ARCHFLAGS="-arch x86_64" gem install pg

이렇게 하면 현재 발생하고 있는 동일한 문제가 해결됩니다.

Linux Mint(Maya) 13에서 이 문제를 해결했습니다. 그리고 postgresql과 postgresql-server를 설치하여 해결했습니다.

apt-get install postgresql-9.1 

sudo apt-get install postgresql-server-dev-9.1

에 관계없이 "" "" "" ""의 합니다."Makefile"맹목적으로 물건을 설치하는 대신에 무슨 일이 일어나고 있는지 보기 위해.

MAC OS의 경우 로그 파일은 다음과 같습니다.

/Users/za/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/pg-1.0.0/mkmf.log

로그에 다음과 같은 이유로 make 파일을 만들 수 없음이 표시되었습니다.

Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers

mkmf.log 내에서 빌드를 완료하는 데 필요한 라이브러리를 찾을 수 없습니다.

checking for pg_config... no
Can't find the 'libpq-fe.h header
blah blah

를 한 후"brew install postgresql"한 모든 볼 수: 필한모라리볼를수있다습니러이요.

za:myapp za$ cat /Users/za/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/pg-1.0.0/mkmf.log | grep yes
find_executable: checking for pg_config... -------------------- yes
find_header: checking for libpq-fe.h... -------------------- yes
find_header: checking for libpq/libpq-fs.h... -------------------- yes
find_header: checking for pg_config_manual.h... -------------------- yes
have_library: checking for PQconnectdb() in -lpq... -------------------- yes
have_func: checking for PQsetSingleRowMode()... -------------------- yes
have_func: checking for PQconninfo()... -------------------- yes
have_func: checking for PQsslAttribute()... -------------------- yes
have_func: checking for PQencryptPasswordConn()... -------------------- yes
have_const: checking for PG_DIAG_TABLE_NAME in libpq-fe.h... -------------------- yes
have_header: checking for unistd.h... -------------------- yes
have_header: checking for inttypes.h... -------------------- yes
checking for C99 variable length arrays... -------------------- yes

저는 수년 동안 PG와 관련된 성가신 문제를 경험해 왔습니다.저는 도움을 주기 위해 이 요지를 만들었습니다.

다음 명령은 항상 사용할 수 있습니다.

# Substitute Postgres.app/Contents/Versions/9.5 with appropriate version number
sudo ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.5/bin/pg_config

요지: https://gist.github.com/sharnie/5588340cf023fb177c8d

5. Running CentOS 5.8에서 을 해야 . 실행 중입니다.bundle install특정 PG 버전을 사용하도록 강제할 수 없어서 계속 문제를 일으켰습니다.

는 할 수 없어 ㅠㅠyum erase postgresql postgresql-devel문제 http 등을 할 수 있음), (http, http를제거할 수 있음)

해결책?$PATH를 임시로 메시지를 보내 기본 업데이트 pgsql 대신 업데이트 pgsql을 선택합니다.

export PATH=/usr/pgsql-9.2/bin:$PATH
bundle install

기본적으로 위의 명령을 사용하면 다음을 확인할 수 있습니다./usr/pgsql-9.2/bin/pg_config맨앞에에 있는 /usr/bin/pg_config

루비 대신 jruby를 사용하는 경우 pgem을 설치할 때 비슷한 문제가 발생합니다.대신 어댑터를 설치해야 합니다.

gem 'activerecord-jdbcpostgresql-adapter'

에서 »brew install postgres그리고나서bundle install

하고 있으며 버전 관리자(Linux(Pop_OS) .10을 하고 있습니다.asdf) Ruby(및 기타)를 위해 그리고 위의 모든 것을 포함하여 그것을 정렬하는 백만 가지 다른 방법을 시도한 후.

TLDR

gem install pg -v '1.2.3' -- --with-pg-config='/home/username/.asdf/installs/postgres/12.6/bin/pg_config'

PG 다음 "PG 설치"를 가리킵니다.pg_config

여기로 이동하여 pg 버전이 Win32 플랫폼을 지원하는지 확인한 다음 다음 명령을 사용하여 다음을 설치합니다.

gem 설치 pg -v 0.14.1 --platform=x86-mingw32

사중인경우를 .asdfpostgres만 하면 .pg이런 보석:

asdf global postgres <version>
gem install pg

언급URL : https://stackoverflow.com/questions/4827092/unable-to-install-pg-gem

반응형