Hướng dẫn install libmysqlclient - cài đặt libmysqlclient

Trang chủ »Python»Python » Hướng dẫn cài đặt thư viện python mysqlclient

Hướng dẫn cài đặt thư viện python mysqlclient

Cài đặt thư viện python mysqlclient

Trên ubuntu ta cần phải cài & nbsp; ________ 8 & nbsp; trước Khi

sudo apt-get install libmysqlclient-dev
pip install mysqlclient

Trán windows ta chỉ cần chạy lệnh:

pip install mysqlclient

Cài đặt mysql bằng cách sử dụng brew và thêm nó vào đường dẫn:

3 hữu ích 0 bình luận chia sẻ

Đăng nhập để trả lời câu hỏi

Có thể bạn quan tâm

Those instructions are for Debian type Linuxes. The closest thing to Debian for OS X is Fink. After getting that installed and set up, you can say

pip install mysqlclient
0 to get essentially the same thing as asking for
pip install mysqlclient
1 on a Debian or Ubuntu type system.

  • Beware that Fink installs its packages in
    pip install mysqlclient
    2, and not all build scripts know to look there for libraries and headers. You might have to give custom build options to get it to figure this out.
  • A path that may be more successful is to simply download the MySQL 5.0 package for Mac OS X. That should include the same development files as
    pip install mysqlclient
    1, and as a bonus will put them in places more likely to be found by your gem.
  • [Why 5.0, by the way? Because that's what corresponds to ABI version 15, which your package apparently requires. Maybe it will in fact work with 5.1, or 5.4, or 6.0, but that would be a risk you'd have to decide to take on your own.]

Tôi đã cài đặt rồi

Collecting mysqlclient
  Using cached mysqlclient-1.3.10.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback [most recent call last]:
      File "", line 1, in 
      File "/private/var/folders/y_/c31n_1v12v169zfv829p_v_80000gn/T/pip-build-f51KhW/mysqlclient/setup.py", line 17, in 
        metadata, options = get_config[]
      File "setup_posix.py", line 54, in get_config
        libraries = [dequote[i[2:]] for i in libs if i.startswith['-l']]
      File "setup_posix.py", line 12, in dequote
        if s[0] in "\"'" and s[0] == s[-1]:
    IndexError: string index out of range

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/y_/c31n_1v12v169zfv829p_v_80000gn/T/pip-build-f51KhW/mysqlclient/
  • Python 2.7.13
  • Django 1.11
  • MySQL 5.7.17
  • Tôi muốn sử dụng MySQL với Django, nhưng sau khi cài đặt trình kết nối mysql, tôi đã cố gắng cài đặt mysqlclient cho Python
    pip install mysqlclient
    4, nhưng tôi gặp sự cố này:

python 1 bình luận 33k xem chia sẻ

answer

48

11 hữu ích 3 bình luận chia sẻ

brew install mysql-client
# mysql-client is not on the `PATH` by default
export PATH="/usr/local/opt/mysql-client/bin:$PATH"
# openssl is not on the link path by default
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"

Đối với Mac: trước tiên hãy tải xuống Xcode từ App Store và MySqlWorkbench từ //dev.mysql.com/downloads/workbench/

Chạy các lệnh sau trong thiết bị đầu cuối, 0 bình luận chia sẻ

answer

21

7 hữu ích 2 bình luận chia sẻ

1.

pip install mysqlclient
8
pip install mysqlclient
8

2.

pip install mysqlclient
7
pip install mysqlclient
7

và sau đó gặp lỗi này, tôi đã Truy xuất mã nguồn , nhưng giải quyết được lỗi này thì lỗi khác lại xảy ra.

vì vậy tôi đã thay đổi cách cài đặt mysqlclient, chỉ cần:

1.

pip install mysqlclient
0

2.

pip install mysqlclient
7

điều này đã làm việc cho tôi, không có bất kỳ lỗi nào xảy ra.

21 hữu ích 1 bình luận chia sẻ 1 bình luận chia sẻ

answer

12

Cài đặt

pip install mysqlclient
2thay vì cài đặt
pip install mysqlclient
3nếu bạn không định có
pip install mysqlclient
3trong máy tính của mình

pip install mysqlclient
5

pip install mysqlclient
6

pip install mysqlclient
7

pip install mysqlclient
7

xuất LDFLAGS = "- L / usr / local / opt / openssl / lib"

xuất CPPFLAGS = "- I / usr / local / opt / openssl / include"

12 hữu ích 2 bình luận chia sẻ 2 bình luận chia sẻ

answer

11

brew install/upgrade/reinstall mysql
brew install mysql-client
export PATH="/usr/local/opt/openssl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
pip install mysqlclient
works perfectly

Cài đặt

pip install mysqlclient
2thay vì cài đặt
pip install mysqlclient
3nếu bạn không định có
pip install mysqlclient
3trong máy tính của mình 3 bình luận chia sẻ

answer

7

Cài đặt

pip install mysqlclient
2thay vì cài đặt
pip install mysqlclient
3nếu bạn không định có
pip install mysqlclient
3trong máy tính của mình

xuất LDFLAGS = "- L / usr / local / opt / openssl / lib"

$ brew install mysql

$ export PATH=$PATH:/Applications/MySQLWorkbench.app/Contents/MacOS

$ xcode-select --install

$ pip install mysqlclient

xuất CPPFLAGS = "- I / usr / local / opt / openssl / include" 2 bình luận chia sẻ

answer

3

Cài đặt

pip install mysqlclient
2thay vì cài đặt
pip install mysqlclient
3nếu bạn không định có
pip install mysqlclient
3trong máy tính của mình

$ brew install mysql

$ export PATH=/usr/local/mysql/bin:$PATH

$ sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib

$ pip install mysqlclient

xuất LDFLAGS = "- L / usr / local / opt / openssl / lib" 0 bình luận chia sẻ

xuất CPPFLAGS = "- I / usr / local / opt / openssl / include"

12 hữu ích 2 bình luận chia sẻ

Bài Viết Liên Quan

Chủ Đề