Ubuntu vault, anaconda, django rest framework 세팅

정규호·2023년 11월 22일
0

출처 : [Linux] Ubuntu 환경변수 설정

출처 : LINUX : Ubuntu에 anaconda3 설치

출처 : [Conda] Conda install by CLI

wget https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh
...
bash Anaconda3-2021.11-Linux-x86_64.sh 
...
done
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> yes
no change     /home/mobtest/anaconda3/condabin/conda
no change     /home/mobtest/anaconda3/bin/conda
no change     /home/mobtest/anaconda3/bin/conda-env
no change     /home/mobtest/anaconda3/bin/activate
no change     /home/mobtest/anaconda3/bin/deactivate
no change     /home/mobtest/anaconda3/etc/profile.d/conda.sh
no change     /home/mobtest/anaconda3/etc/fish/conf.d/conda.fish
no change     /home/mobtest/anaconda3/shell/condabin/Conda.psm1
no change     /home/mobtest/anaconda3/shell/condabin/conda-hook.ps1
no change     /home/mobtest/anaconda3/lib/python3.9/site-packages/xontrib/conda.xsh
no change     /home/mobtest/anaconda3/etc/profile.d/conda.csh
modified      /home/mobtest/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

If you'd prefer that conda's base environment not be activated on startup, 
   set the auto_activate_base parameter to false: 

conda config --set auto_activate_base false

Thank you for installing Anaconda3!

출처 : [Ubuntu 20.04] 우분투에 아나콘다 설치 및 Python 가상환경 설정

pip install -r requirements.txt
...
trying to install packages on ubuntu20.04 with pip and got these errors
{Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      /bin/sh: mysql_config: command not found
      /bin/sh: mariadb_config: command not found
      /bin/sh: mysql_config: command not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-fs5bn547/mysqlclient_63fae23ad4ec4949b4dc920979388076/setup.py", line 15, in <module>
          metadata, options = get_config()
        File "/tmp/pip-install-fs5bn547/mysqlclient_63fae23ad4ec4949b4dc920979388076/setup_posix.py", line 70, in get_config
          libs = mysql_config("libs")
        File "/tmp/pip-install-fs5bn547/mysqlclient_63fae23ad4ec4949b4dc920979388076/setup_posix.py", line 31, in mysql_config
          raise OSError("{} not found".format(_mysql_config_path))
      OSError: mysql_config not found
      mysql_config --version
      mariadb_config --version
      mysql_config --libs
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.
}
...
sudo apt-get update
sudo apt-get install libmysqlclient-dev
...
pip install -r requirements.txt
...
after that I commnad pip install -r requirement.txt and got these error
{Building wheel for pyodbc (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'pyodbc' extension
      creating build
      creating build/temp.linux-x86_64-cpython-38
      creating build/temp.linux-x86_64-cpython-38/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 -fwrapv -O2 -fPIC -DPYODBC_VERSION=4.0.32 -I/usr/include/python3.8 -c src/buffer.cpp -o build/temp.linux-x86_64-cpython-38/src/buffer.o -Wno-write-strings
      In file included from src/buffer.cpp:12:
      src/pyodbc.h:56:10: fatal error: sql.h: No such file or directory
         56 | #include <sql.h>
            |          ^~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyodbc
  Running setup.py clean for pyodbc
Successfully built mysqlclient
Failed to build pyodbc
ERROR: Could not build wheels for pyodbc, which is required to install pyproject.toml-based projects}
...
sudo apt-get update
sudo apt-get install unixodbc unixodbc-dev
...
pip install -r requirements.txt
...
after I install all the package, try to run python manage runserver 0:8000 and got these error
{System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/home/mobtest/.local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
    self.connect()
  File "/home/mobtest/.local/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/home/mobtest/.local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/home/mobtest/.local/lib/python3.8/site-packages/mssql/base.py", line 326, in get_new_connection
    conn = Database.connect(connstr,
pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")}
...

출처 : 프로그램을 추가하고, 삭제하고, 업데이트하는 방법

profile
The Man Who Lift

0개의 댓글

관련 채용 정보